My sequence of Macros stops running after one of the macros closes another workbook

dougmarkham

Active Member
Joined
Jul 19, 2016
Messages
252
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

Hope you're having a great Friday!

I am running a sequence of macros as follows:

Code:
Sub RunMacroSequence_Click()
    Call ClearContentsBelowRowTwo 'Macro1
    Call copyDataFromMultipleWorkbooksIntoMaster 'Macro2
    Call ExportOpsManPOReconExport 'Macro3
[B][COLOR=#b22222]    Call CloseWorkbookCCSWithoutSaving 'Macro4[/COLOR][/B]
    Call CloseWorkbookAPSWithoutSaving 'Macro5
    Call CloseWorkbookCognosLMSImporterWithoutSaving 'Macro6
    Call openwbPOReconLive 'Macro 5
End Sub

The sequence is interrupted when Macro 4 runs to close another workbook via...

Code:
Sub CloseWorkbookCCSWithoutSaving()
Workbooks("CCS Template2").Close SaveChanges:=False
End Sub

The file it's closing is a *.xltm file---if that makes any difference.

Is it possible to resume the sequence of macros after the VBA in one of the macros closes another workbook?

Also, I am interested to know why this happens: is this happening because the workbook I'm closing becomes active prior to closing, thus stopping the macro sequence from completing?

If you would help me with this, I'd be very grateful :)

Kind regards,

Doug.
 
Doug

Which workbook is the code in?

Which workbook(s) are you opening?

PS Why are you closing the workbook(s) you are opening before pasting? That could cause problems.
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,214,943
Messages
6,122,380
Members
449,080
Latest member
Armadillos

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