Solved

Excel macro for username of the computers

Posted on 2011-03-14
3
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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 Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

710 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