save cell value in txt file

  • Thread starter Thread starter Michael
  • Start date Start date
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
 
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.)
 
Back
Top