Code:
Sub savereport()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
ChDrive Left(ActiveWorkbook.Path, 2)
ChDir ActiveWorkbook.Path
SaveAsName = Application.GetSaveAsFilename(FileFilter:="Excel Files (*.xlsx), *.xlsx")
If SaveAsName <> False Then
ActiveWorkbook.SaveAs Filename:=SaveAsName, FileFormat:= _
xlOpenXMLWorkbook, WriteResPassword:="testing", ReadOnlyRecommended:=False _
, CreateBackup:=False
ElseIf SaveAsName = False Then
MsgBox ("User cancelled saving")
Exit Sub
End If
Application.DisplayAlerts = True
End Sub
Code:
sub starting()
Call importreport
Call formatreport
Call savereport
End Sub
I have savereport sub to save my excel file as reserved file. However after adding if statement, my sub is no longer working from sub starting.
If I run just savereport it works fine, but It gets ignored when I run starting sub. Does anyone has idea what's wrong with this code?
Thank you!