sub is getting ignored from call subs

jaik22

Board Regular
Joined
Sep 23, 2016
Messages
102
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!
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
38,496
Office Version
365
Platform
Windows
Have you changed anything in the other 2 subs it's calling?
It sounds as the if the macro is quitting before it gets to the final call
 

Watch MrExcel Video

Forum statistics

Threads
1,095,247
Messages
5,443,326
Members
405,227
Latest member
Ankit Jain

This Week's Hot Topics

Top