Who last accessed file?

dwebb03

New Member
Joined
Aug 6, 2003
Messages
22
How do you display in a cell who last accessed the spreadsheet. I searched and found ways of hiding it in logfiles but I don't want that, who ever opens file needs to see who last accessed it.
Thank you in advance your help is appreciated
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Open the file in NotePad. Scroll some where near the middle and at the top to reveal who last looked at the file. This is different than who last saved the file.

As for displaying it in a cell, I'm not sure how to do that.
 
Upvote 0
Paste this code into the "ThisWorkBook" object in VBA

Private Sub Workbook_Open()
With Sheets("Sheet1")
NxRow = .Cells(65536, 1).End(xlUp).Row + 1
.Cells(NxRow, 1).Value = Module1.GetUserName
.Cells(NxRow, 2).Value = Date
End with
End Sub


Create a MODULE1 and Paste the following code into it :

Option Explicit
' This is used by GetUserName() to find the current user's
' name from the API
Declare Function Get_User_Name Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, _
nSize As Long) As Long
Function GetUserName() As String
Dim lpBuff As String * 25

Get_User_Name lpBuff, 25
GetUserName = Left(lpBuff, InStr(lpBuff, Chr(0)) - 1)
End Function


NOW.... when Workbook is open the persons name will be added to Sheet1 , along with date of opening.
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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