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!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top