View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Wilson John Wilson is offline
external usenet poster
 
Posts: 550
Default On opening an excel file

pcor,

One way.....
Original code from John Walkenbach

Open ThisWorkbook.Path & "\Logs\GB.log" For Append As #1
Print #1, Application.UserName, Now, "Opened"
Close #1

The above explained (modify at will):
1st Line - Opens a text file named GB.log in a subdirectory named
"Logs" underneath the current directory that the workbook was saved in.
2nd Line - Append the UserName, Date & Time and the comment "Opened"
to the GB.log file
3rd Line - close and save the GB.log file.

Notes....
The directory or subdirectory that you're creating the file in must exist
but the file itself doesn't have to exist (it will be vreated the first time
and appended to each subsequent time).
Place the above code in the Workbook_Open Event or in a regular module
and name the sub Auto_Open().

John

pcor wrote:

I want the program to write the date and time to a file on disk everytime
this Excel file is opened.
Help please.

--
Norton Virus checker 2003 says this email is clean