PDA

View Full Version : VBA to sequence/ order a list of macros



rwc1023
06-07-2021, 10:34 AM
Hello - can you VBA to add sequence to the macros created in PowerPoint?
I got a bunch of macros written in VBA (about 10 different macros) but in order for them to run correctly, they must work in order. If someone opens the Macros there is no way to put orders or sort them, is there? the macros just show up in a list not in any order.

Basically a bunch of us are going through converting hundreds of PowerPoint decks. I created VBA to convert them and then I exported the VBAs to a file and ask the team to import them to their powerpoint decks. We need to figure out how to put sequence to the macros or create a quick button to click and process through the macros in the order that will work.

can that be done? what is the most efficient method? hoping someone will share some thoughts. thank you!!

Bob Phillips
06-07-2021, 10:42 AM
Why not just create a manager procedure that runs them all in the correct order.

rwc1023
06-07-2021, 10:57 AM
Why not just create a manager procedure that runs them all in the correct order.

Hi Bob - not sure if i completely understand this. will you give me an example? thank you!

Paul_Hossler
06-07-2021, 11:17 AM
1. Use Option Private Module on the module(s) that you don't want them to run. Makes them 'invisible' to the user

2. Create a 'Super Sub' that runs the other modules in the correct order



Option Explicit
Option Private Module


Sub Hello1()
MsgBox "Hello1"
End Sub
Sub Hello2()
MsgBox "Hello2"
End Sub
Sub Hello3()
MsgBox "Hello4"
End Sub
Sub Hello4()
MsgBox "Hello4"
End Sub


Other module



Option Explicit


Sub RunThemAll()
Hello1
Hello2
Hello3
Hello4
End Sub

Bob Phillips
06-08-2021, 05:31 AM
Paul show you how, but you could also make all the sub-procedures as functions, they won't then show up in the list of macros from the Excel UI. Another way would be to put all the sub-procedures in a separate code module, and add Option Private Module at the head of the module, again they won't show.