Reputation: 147
I have a macro running in the Workbook BeforeSave event
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then
'read destination path somehow
'perform business logic using the destination folder
End If
End Sub
Certain validation on the workbook content need to take place only if the file is saved to a certain destination, this may result in the save action being cancelled.
I have been unable to find a way to read what the user specified as the destination path. I need some help please as I am not a VBA specialist.
Upvotes: 0
Views: 63
Reputation: 173
It appears to me the event fires before a destination path is chosen. You probably have to use the WorkbookAfterSave event and then perform the validation afterwards.
https://learn.microsoft.com/en-us/office/vba/api/excel.application.workbookaftersave
Upvotes: 1