Solved

Excel macro for username of the computers

Posted on 2011-03-14
3
253 Views
Last Modified: 2012-06-27
Dear experts,
I would like to learn who has opened my excel file in the company where we use a network and every computer has a username?
I need a macro for this.
do you know one?
0
Comment
Question by:Braveheartli
3 Comments
 
LVL 17

Expert Comment

by:sgsm81
ID: 35126633
0
 
LVL 50

Accepted Solution

by:
Dave Brett earned 500 total points
ID: 35126677
If you add this code to the ThisWorkbook module it will append records to a text file (log.txt" in the same path as the file is stored

It will write
System Log On, PC Name, Time

You can change the log file path, ie to write to z:\temp where z is a network drive

Open "z:\temp\usage.log" For Append As #1

Cheers

Dave
Private Sub Workbook_Open()
    Open ThisWorkbook.Path & "\log.txt" For Append As #1
    Print #1, Environ("username"), Environ("computername"), Now
    Close #1
End Sub

Open in new window

0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 35126739
Dear brettdj,
your answer is great,
thank you very much,
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert SuperCalc files to Excel 9 45
Response times in Excel 18 44
SKip past fields with no data 6 15
V-Lookup 11 19
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question