ChrisJ
03-29-2007, 05:44 AM
Hello,
I have the following bit of code for saving a file with the name of a specific cell. This bit works fine, I have a problem when you select No or Cancel from the Saveas dialog box I get 1004 runtime error, telling me Method 'SaveAs' of object'_Workbook' failed
Sub GenSave()
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Application.Goto "PICName"
ActiveWorkbook.SaveAs Filename:=ActiveCell.Value, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
Application.Range("Mth").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
Can someone suggest how I can prevent this but retaining the ability of saving with name of the file being a cell contents (in this case "PICName")
Thankyou in advance
Chris
:dunno
Edited 30-Mar-07 by geekgirlau. Reason: insert vba tags
I have the following bit of code for saving a file with the name of a specific cell. This bit works fine, I have a problem when you select No or Cancel from the Saveas dialog box I get 1004 runtime error, telling me Method 'SaveAs' of object'_Workbook' failed
Sub GenSave()
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Application.Goto "PICName"
ActiveWorkbook.SaveAs Filename:=ActiveCell.Value, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
Application.Range("Mth").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
Can someone suggest how I can prevent this but retaining the ability of saving with name of the file being a cell contents (in this case "PICName")
Thankyou in advance
Chris
:dunno
Edited 30-Mar-07 by geekgirlau. Reason: insert vba tags