Check If Workbook is Saved using Excel VBA
Use Saved property of Workbook to check the status. Saved returns True if no changes have been made to the specified workbook since it was last saved
Function IsDirty(ByRef OWB As Workbook) As Boolean
If OWB.Saved = False Then
IsDirty = True
End If
End Function
At times, the workbook would have been created and never saved. In that case, you can use the Path property to identify if it was saved at all
Function IsNeverSaved(ByRef OWB As Workbook) As Boolean
If OWB.Path = “” Then
IsNeverSaved = True
End If
End Function