Retrieve an External Excel Workbook’s Last Modified By with VBA
Question details
Retrieve the last author and last saved time from an external Excel workbook using VBA stored elsewhere.

- Product
- Microsoft Excel VBA
- Device & OS
- not provided
- Scenario
- A macro-enabled workbook needs to inspect another workbook that cannot contain macros.
- Observed behavior
- The Last Author property may return a blank value, including for a workbook stored in SharePoint.
Use desktop Excel with VBA available, and store the macro in a separate macro-enabled workbook. Close the target workbook before running the example and make sure you can access its file location.
Read the external workbook’s built-in properties with VBA
Use a macro in a separate workbook to open the target read-only and report its saved author and time.
The properties are stored in the target workbook; they do not require a macro inside that file. An empty or unavailable property is not necessarily proof that no one edited the workbook.
In the macro-enabled workbook, open Developer > Visual Basic, then choose Insert > Module.
Paste this code into the module: Sub ReadExternalWorkbookProperties() Dim filePath As Variant Dim target As Workbook Dim lastAuthor As String, lastSaved As String Dim oldSecurity As Long Dim errorMessage As String filePath = Application.GetOpenFilename("Excel Files (*.xls*),*.xls*") If VarType(filePath) = vbBoolean Then Exit Sub oldSecurity = Application.AutomationSecurity On Error GoTo Failed Application.AutomationSecurity = 3 ' Force-disable macros when opening the target Set target = Workbooks.Open(CStr(filePath), UpdateLinks:=0, ReadOnly:=True) Application.AutomationSecurity = oldSecurity On Error Resume Next lastAuthor = CStr(target.BuiltinDocumentProperties("Last Author").Value) lastSaved = CStr(target.BuiltinDocumentProperties("Last Save Time").Value) On Error GoTo Failed If Len(lastAuthor) = 0 Then lastAuthor = "Blank or unavailable" If Len(lastSaved) = 0 Then lastSaved = "Blank or unavailable" MsgBox "Last Author: " & lastAuthor & vbCrLf & "Last Save Time: " & lastSaved CleanUp: On Error Resume Next If Not target Is Nothing Then target.Close SaveChanges:=False Application.AutomationSecurity = oldSecurity Exit Sub Failed: errorMessage = Err.Description MsgBox "Could not read the workbook: " & errorMessage, vbExclamation Resume CleanUp End Sub
In Excel, choose Developer > Macros, select ReadExternalWorkbookProperties, and click Run. Select the external workbook in the file picker; the macro displays its properties and closes it without saving.

Check the SharePoint library’s modified information
Use SharePoint metadata when the workbook’s built-in Last Author property is blank or you need the library’s recorded editor.
Work with Excel Workbooks in WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface for opening and editing Excel files. Its format support makes moving everyday workbook tasks from Microsoft Office straightforward, although it does not fix Excel VBA metadata issues.

Frequently Asked Questions
Does the external workbook need to contain a macro?
No. Put the VBA code in a separate macro-enabled workbook and use Workbooks.Open to read the external workbook’s BuiltinDocumentProperties.
Why does Last Author return a blank value?
The workbook may not have a usable Last Author property stored. For a SharePoint file, check the library’s Modified By column as a separate source of information.
Is Last Save Time the same as SharePoint’s Modified time?
Not necessarily. Last Save Time is a built-in workbook property, while Modified is maintained by SharePoint. Check the library column when you need the server-side value.
Why use the target workbook variable instead of ActiveWorkbook?
Workbooks.Open returns a reference to the target workbook. Reading target.BuiltinDocumentProperties avoids relying on whichever workbook happens to be active.
Can I run this macro in Excel for the web?
No. Open the macro-enabled workbook in desktop Excel to run VBA from Developer > Macros.




