![]() |
Recording user and date of when a file is opened
Hi,
Is there a way to program VB to record the name of the user and date of when someone opens a file? I'm thinking the only way to do this would be to code to have a form open when someone opens the file that asks for their name and then have the code record the persons name and the date...wondering if there's an easier way. Thanks, Robert |
Recording user and date of when a file is opened
It is a whole pile easier than that. In the ThisWorkbook module there is an
event called Workbook_Open. This fires whenever the borkbook is opened. I recomend having a hidden sheet (possibly very hidden depending on what you want). Lets call it User Log. Your code will look something like this... Private Sub Workbook_Open() Dim rng As Range Set rng = Sheets("User Log").Range("A65536").End(xlUp).Offset(1, 0) rng.Value = Environ("UserName") rng.Offset(0, 1) = Now() End Sub -- HTH... Jim Thomlinson "Linking to specific cells in pivot table" wrote: Hi, Is there a way to program VB to record the name of the user and date of when someone opens a file? I'm thinking the only way to do this would be to code to have a form open when someone opens the file that asks for their name and then have the code record the persons name and the date...wondering if there's an easier way. Thanks, Robert |
Recording user and date of when a file is opened
Wow - this perfect -- and MUCH easier like you said. Thank you!!
"Jim Thomlinson" wrote: It is a whole pile easier than that. In the ThisWorkbook module there is an event called Workbook_Open. This fires whenever the borkbook is opened. I recomend having a hidden sheet (possibly very hidden depending on what you want). Lets call it User Log. Your code will look something like this... Private Sub Workbook_Open() Dim rng As Range Set rng = Sheets("User Log").Range("A65536").End(xlUp).Offset(1, 0) rng.Value = Environ("UserName") rng.Offset(0, 1) = Now() End Sub -- HTH... Jim Thomlinson "Linking to specific cells in pivot table" wrote: Hi, Is there a way to program VB to record the name of the user and date of when someone opens a file? I'm thinking the only way to do this would be to code to have a form open when someone opens the file that asks for their name and then have the code record the persons name and the date...wondering if there's an easier way. Thanks, Robert |
All times are GMT +1. The time now is 01:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com