Changing the Path In a Usage Log

R

Red

The below is a macro I copied from one of the postings. The macro
works great, however the file "usage.log" saves in the same directory
as the workbook.
Can anyone tell me how I can save the "usage.log" to another directoy?


Private Sub Workbook_Open()
Open ThisWorkbook.Path & "\usage.log" For Append As #1
Print #1, Environ$("userName"), Now
Close #1
End Sub
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
G

Guest

move the usage.log to a directory you want. then change
the code to the path to the new path.
this code is not saving as we understand saving. it is
opening a file and printing/appending to it then closing
the file. same thing as a save in a way but different.
 
D

Dave Peterson

Private Sub Workbook_Open()
Open "C:\mylogfolder\usage.log" For Append As #1
Print #1, Environ$("userName"), Now
Close #1
End Sub
or
Private Sub Workbook_Open()
Open "\\server\sharename\foldername\usage.log" For Append As #1
Print #1, Environ$("userName"), Now
Close #1
End Sub
 
R

Red

Thanks but I was fortunate to find this solution that works for me

Private Sub Workbook_Open()

Const Log As String = "\\Shared\Main_Public\File Name\ Open.LOG"

On Error Resume Next

Open Log For Append As #1

Print #1, Environ$("userName"), Now

Close #1
 

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