Macro calling macros then not running additional macros?

bmpreston

Board Regular
Joined
Jun 18, 2016
Messages
120
Office Version
  1. 365
Platform
  1. MacOS
So I have multiple macros to keep things clean. It may be extra macros but it help in case files change etc.

I have a master 'CallMacros' macro assigned to a button

Clicking this button, calls 11 macros, let's call them Macro1, Macro2, Macro3, etc.

Each macro is:

Workbooks.open (a predefined sheet, each macro1, macro2 calls a corresponding sheet)
Application.run (Calls a macro in each of the above sheets, some of the basic functions of these macros are to update links, save, email, and close that file...)

BUT, it stops after macro1. Macro2 never runs. It never completes the CallMacro...

Any help?

Thanks
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Do any of your macros contain the word End on its own? (ie not including End If, End With etc)
 
Upvote 0
All have an End Sub,

Many have a check to End With, but I find it weird that if I call multiple macros within one workbook, they all process; calling multiple worksheets, then their multi-macro-macro, stops after processing the first workbook is completed.

So, I open workbook1 and call workbookA, run workbookA.macro (which calls macros) Then one of the macros is to save, close the workbook, but workbook1.macro stops processing after workbookA.macro is complete, it never begins the process of workbookB.macro (which is minor differences of course from workbookA.macro

If I run workbookA.macro IN ITS OWN WORKBOOK, it runs complete and fine and to my liking.

Thanks
 
Upvote 0
It's very difficult to diagnose the problem without being able to see your code.
It may be that you have an error handler that's causing the problem.
Could you post all your code?
 
Upvote 0
Yes. It'll be a bit. I pull macros from about 14 sheets, edit links to 23 sheets. I email each sheet to a different location each week, etc.

It's a lot and it's a mess I know. I have theories to my logic, but not so sure...
 
Upvote 0
Are you saying your initial macro is in "Workbook 1"

You run the macro in workbook 1 and then the macro opens "Workbook 2"
And then the macro closes Workbook1 and you want the macro to continue running and do things in "Workbook3"

If that is the case your macro will stop when you close Workbook1
 
Last edited:
Upvote 0
@ MAIT
My understanding is that Book 1 opens, process & closes BookA.
It should then open BookB.
The OP says nothing about closing Book1. But who knows?
 
Upvote 0
The workbooks 1-11 all have macros to perform basic functions. Filtering a column, forcing an external sheet update, save dialog box, close the workbooks, etc. Each workbook (1-11) has a master macro, to call on each smaller macro (the save, filtering, external sheet update, etc)

One MASTER workbook (Workbook A) has a call to EACH of the workbooks (1-11) master macro, and each of these are Application.run to run the previous Macros.

In simplist terms, one macro, opens 11 sheets, runs a macro per workbook. However after completing one workbook, it does not process another. Workbook A's master macro, processes one sheet, then stops.

If I run the macros individually, they continue to run one at a time.

Here is the master macro:
'Do stuff, open workbook 2 etc

Sub Start()

Burris
Garrison
Selesky
Navarre
Ohlenbusch
Preston
Price
Prievo
Stahl
Young
Wilson
Master_Stale

End Sub



Here is The Burris VB as mentioned above, all others identical;

Sub Burris()

Workbooks.Open "C:\Users\Bprest1\Backup\Documents\Inventory\Master Region Stale\Team\Send\Michael Burris.xlsm"

Application.Run "'C:\Users\Bprest1\Backup\Documents\Inventory\Master Region Stale\Team\Send\Michael Burris.xlsm'!CallSendMacros"

End Sub

Inside Michael Burris (this would be 1 of 11 or so files), I have a few more macros, CallSendMacros is this;
Sub CallSendMacros()
UpdateLinks
HideColumns
apply_autofilter_across_worksheets
MAIL_TO_TECHNICIAN
CloseandSave
End Sub

All of the above are pretty self-explanatory, updating external files, hides some columns, applies autofilter, emails the file, closes and saves it.

I hope this helps.
 
Upvote 0
Yes,

I was typing while you replied. See my last post please.

@ MAIT
My understanding is that Book 1 opens, process & closes BookA.
It should then open BookB.
The OP says nothing about closing Book1. But who knows?
 
Upvote 0
Without being able to see the actual code, There's not much I can do.
Your best bet is, in the VBE, put the cursor somewhere in the Sub Start() macro & hit F8 (repeatedly), this will allow you to step through the code, line by line.
Hopefully this will allow you to see where things are going wrong.
 
Upvote 0

Forum statistics

Threads
1,215,368
Messages
6,124,520
Members
449,169
Latest member
mm424

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