excelvba

Determine if an Excel workbook has ever been saved?


How can I tell, using VBA, if an Excel workbook has ever been saved?

I want to know if clicking save will save the document to an existing location or prompt me to choose a save location.


Solution

  • If ActiveWorkbook.Path = vbNullString Then
        'actions if the active workbook hasn't been saved yet go here
    Else
        '....
    End If