save cell value in txt file

M

Michael

Hello everyone,
i would like to know if someone know a macro which could save the value of a
cell in a txt file.
like in the cell A1 there would be written "something" and i would like a
macro to save that in a txt file.

thanks a lot by advance.

Mike
 
D

Dave Peterson

You could create a new workbook, copy the value in A1 to that new sheet and
saveAs a text file.

Or you could just write the value to a text file.

Option Explicit
Sub testme01()

Close #1
Open "c:\textfile.txt" For Output As #1
Print #1, ActiveSheet.Range("A1").Text
Close #1

End Sub




If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top