ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   create .TXT file Log (https://www.excelbanter.com/excel-programming/273402-create-txt-file-log.html)

spence[_2_]

create .TXT file Log
 
i have this to create a txt file in excel's program files
directory. how can i modify it to put the txt file on my
C:\ drive.


Private Sub workbook_beforeclose(cancel As Boolean)
Open Application.Path & "\Log.txt" _
For Append As #1
Print #1, "Stopped " & Now
Close #1
End Sub

TIA

MicMast

create .TXT file Log
 
or make a var above, something like this:
loc = application.path & "\Log.txt"
open loc for...

"Chip Pearson" wrote in message ...
Spence,

Change

Open Application.Path & "\Log.txt" _
to
Open "C:\Log.txt" _


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"spence" wrote in message
...
i have this to create a txt file in excel's program files
directory. how can i modify it to put the txt file on my
C:\ drive.


Private Sub workbook_beforeclose(cancel As Boolean)
Open Application.Path & "\Log.txt" _
For Append As #1
Print #1, "Stopped " & Now
Close #1
End Sub

TIA



All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com