txt file

L

luc

I would like to transfer the value of a few cells(date, cost and profit) to
some txt file, and this every time the xls file is closed. How would one do
that?
 
F

Frank Kabel

Hi
just as a starting point:
- you can use the workbook event 'Workbook_Beforeclose' to put this
code into (see http://www.cpearson.com/excel/events.htm for more
details about event procedures)

- you may try the following code as starting point in your workbook
module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim output_str
output_str=Cstr(me.worksheets("sheet1").range("A1").value)

Open "C.\temp\logfile.txt" For Output As #1
Write #1, output_str
Close #1
end Sub
 
Top