VBA & Macro Problems

Retrieve an External Excel Workbook’s Last Modified By with VBA

Emma BrownEmma Brown Nov 27, 2026 869 views

Question details

Retrieve the last author and last saved time from an external Excel workbook using VBA stored elsewhere.

Retrieve an External Excel Workbook’s Last Modified By with VBA
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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In the macro-enabled workbook, open Developer > Visual Basic, then choose Insert > Module.

2
Paste the macro

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

3
Run and select the file

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.

Read the external workbook’s built-in properties with VBA
If Last Author is blank: The workbook may not contain a usable Last Author value. Check the SharePoint library’s Modified By column if the file is stored there; that server-side value is separate from the workbook’s built-in property.
Free Microsoft Office alternative

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.

Open and edit spreadsheets in a familiar interfaceCompatible with common Microsoft Excel formats, including XLSX and XLSWork with external workbook data without placing a macro in the target fileFree and lightweight for everyday office tasks
microsoft office alternative - wps office

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.