Usage Tracker

INSONIC

New Member
Joined
Jul 30, 2010
Messages
3
Hi all, i'm new to the site.

I have to produce a weekly report in excel and i want to track who open the report.

I have a script that tracks it in the document, but i want it to write it to another excel document on a shared drive, as not everyone saves it.

UserName = Environ("UserName")
myUser = "User: " & UserName & _
", On: " & Application.WorksheetFunction.Text(Now(), "m/d/yyyy at hh:mm AM/PM")
Worksheets("usage").Range("A65536").End(xlUp).Offset(1, 0).Value = myUser
End Sub
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Welcome to the site! :)

Can't you just save the workbook as soon as you've wrote to the cell?

Code:
UserName = Environ("UserName")
myUser = "User: " & UserName & _
", On: " & Application.WorksheetFunction.Text(Now(), "m/d/yyyy at hh:mm AM/PM")
Worksheets("usage").Range("A65536").End(xlUp).Offset(1, 0).Value = myUser

ActiveWorkbook.Save

End Sub
Thats how I do it :)
 
Upvote 0
The only problem i have, is that around 20 people could open the document at any time, so they would open it as a read only, not saving on the document, this way it would write straight to another document that i could have auto save. i dont want to share the document due to errors i find normally.

Thanks everyone for your help
 
Upvote 0
Ah - Sorry, bit of a lazy post there...

Try this :)

Code:
Dim wb As Workbook
    Set wb = Workbooks.Open("test.xls")
        wb.Sheets("usage").Select
        UserName = Environ("UserName")
        myUser = "User: " & UserName & _
        ", On: " & Application.WorksheetFunction.Text(Now(), "m/d/yyyy at hh:mm AM/PM")
        Worksheets("usage").Range("A65536").End(xlUp).Offset(1, 0).Value = myUser
        wb.Close savechanges:=True

Obivously replace "test.xls" with your Workbook that you want to record your details in :)
 
Upvote 0

Forum statistics

Threads
1,214,556
Messages
6,120,190
Members
448,949
Latest member
keycalinc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top