I am having an issue with my save copy on close VBA code. I am wanting to save a OneDrive shared file (which is a .xlsb file type) upon closing the file to a network drive, but am wanting to save it as a .xlsx file, not .xlsb file type. If I use this code, the file will save, but I get an error when I try to open the duplicate file saying that it is the wrong file type. If I change it to save as a .xlsb file type, it works. I am wanting to save a regular excel workbook, not a macro workbook. Can anyone assist me?
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With ThisWorkbook
Application.DisplayAlerts = False
.SaveCopyAs Filename:="J:\folder1\folder2\afilename.xlsb"
Application.DisplayAlerts = True
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
With ThisWorkbook
Application.DisplayAlerts = False
.SaveCopyAs Filename:="J:\folder1\folder2\afilename.xlsb"
Application.DisplayAlerts = True
End With
End Sub
Last edited by a moderator: