Creating an access log

M

matpj

Is it at all possible to create a text file, so that when any user opens
a particular spreadsheet, their username and current system date is
appended to the text file?

I'm inerested in creating an access log for one of our spreadsheets.
I'm no VBA expert, but i'm assuming this might quite straight forward.
Havent got a clue how to get the user's login ID, or Excel User name,
so any help will be appreciated.

thanks in advance,
Matt
 
G

Guest

Yes, I answered the same question a while back but cannot remember the link;
search this group for access log
 
M

matpj

hi,

thanks for the response.
I couldn't find a post with a reply frmo you, but I found another on
that does exactly what I want, although the spreadsheet I am creatin
will be saved in a Notes database.

I need the log file to be in a specified network path although when
try to use that, it throws up an error.

the original code for the log is:


Code
-------------------
Sub DoTheLog(myKey As String)
Open ThisWorkbook.Path & "\" & Left(ActiveWorkbook.Name, _
Len(ActiveWorkbook.Name) - 4) & "_usage.log" For Append As #1
Print #1, myKey & vbTab & Application.UserName _
& vbTab & fOSUserName _
& vbTab & fOSMachineName _
& vbTab & Format(Now, "mmmm dd, yyyy hh:mm:ss")
Close #1
End Su
-------------------


i'm trying to change the Open bit to read:


Code
 
N

NickHK

matpj,
What does the "Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)"
part evaluate to ?

NickHK
 
M

matpj

that makes sure that the ".xls" is removed from the file name when
giving a name to the log file! :)
 

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