Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Excel and events

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lumpjaw - 15 Nov 2006 02:26 GMT
I would like to write to an event log named 'Trackers' that records a users
name and machine everytime a specific execl workbook is updated, can this be
done?  How do I go about making the event log?  Thanks

-lumpjaw
Roger Govier - 15 Nov 2006 09:20 GMT
Hi

You would need to enter something like the following in a Workbook event
before save.
This will open a file called Tracker.txt in the same folder as the
workbook, and add a row with the relevant details for you.

This must be pasted into the ThisWorkbook module, NOT in a standard
module.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

 Open ThisWorkbook.Path & "\Trackers.txt" For Append As #1
   Print #1, Environ("USERNAME")  & ","  &Environ("COMPUTERNAME")  &
"," & Now
   Close #1

End Sub

You can copy the code and paste it into your Visual Basic Editor
To do this,

Alt + F11 (open VBE)
Ctrl + R (open Project Explorer)
Select the file name on the left
Select This WorkBook
Paste code in Module

For more help on inserting macros
David McRitchie has lots of useful help on his site at
http://www.mvps.org/dmcritchie/excel/install.htm
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Signature

Regards

Roger Govier

>I would like to write to an event log named 'Trackers' that records a
>users name and machine everytime a specific execl workbook is updated,
>can this be done?  How do I go about making the event log?  Thanks
>
> -lumpjaw

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.