G
Guest
Is there a result code for the SaveAs method that I could use to
conditionally direct the execution of this code around the block of code that
starts "If Err.Number..." if the user elects not to save the file?
Here is the code:
If fs.FileExists(strPathName) Then
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=strPathName, _
FileFormat:=xlNormal, _
ReadOnlyRecommended:=False, _
CreateBackup:=False
If Err.Number = 1004 & Left(strFileName, 2) <> "ts" Then
Msg = "Save aborted. This timesheet will now close. Open " _
& strFileName & " directly in " & strSaveDirectory & "."
MsgBox Msg, vbOKOnly, "Error"
ActiveWorkbook.Close SaveChanges:=False
End If
On Error GoTo 0
Err.Clear
Thank you.
John Wirt
conditionally direct the execution of this code around the block of code that
starts "If Err.Number..." if the user elects not to save the file?
Here is the code:
If fs.FileExists(strPathName) Then
On Error Resume Next
ActiveWorkbook.SaveAs Filename:=strPathName, _
FileFormat:=xlNormal, _
ReadOnlyRecommended:=False, _
CreateBackup:=False
If Err.Number = 1004 & Left(strFileName, 2) <> "ts" Then
Msg = "Save aborted. This timesheet will now close. Open " _
& strFileName & " directly in " & strSaveDirectory & "."
MsgBox Msg, vbOKOnly, "Error"
ActiveWorkbook.Close SaveChanges:=False
End If
On Error GoTo 0
Err.Clear
Thank you.
John Wirt