Macro to run several macros at once

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to have one action button run several macros at once. I thought
the easiest way would be to set up a macro (A) to run all the other macros
and then set the action button to run macro (A). Can this be done? Am I on
the right track?

I dont know if this makes a difference or not, but the macros that need to
run are all activeX ComboBoxes on various slides and are "Private Subs". Ive
tried the following, but its not working. Any help is greatly appreciated.

Sub BeginReport ( )
Dim BeginReport as String
BeginReport ActionSettings(ppMouseClick).Action = ppActionRunMacro
BeginReport.ActionSettings(ppMouseClick).Run = "Slide11.ComboBox1_Change"
BeginReport.ActionSettings(ppMouseClick).Run = "Slide5.ComboBox1_Change"
BeginReport.ActionSettings(ppMouseClick).Run = "Slide87.ComboBox1_Change"
BeginReport.ActionSettings(ppMouseClick).Run = "Slide87.ComboBox2_Change"
ActivePresentation.SlideShowWindow.View.GotoSlide (9)
ActivePresentation.Saved = True
End Sub
 
I don't do a lot with controls, but this doesn't look right to me. First
of all, your macros are private subs, so you won't be able to run them
from outside the module they are in. Second, a shape can only be assigned
one macro. However, that macro can call other macros. You need something
more along the lines of:

Sub BeginReport()
FirstMacro
SecondMacro
ThirdMacro
End Sub

where FirstMacro, SecondMacro, and ThirdMacro are public Subs. Then,
assigning the BeginReport sub to the single button that needs to run this
should work.

Now, to solve your public private problem, you might be best off having
your Slide11_ComboBox1_Change macro call the public macro FirstMacro:

Private Sub Slide11_ComboBox1_Change()
FirstMacro
End Sub

However, exactly how this all works depends on the details of what you
want to do.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Thanks for the response, Ive been playing around with your suggestion for a
few days and am still having no luck.

The combobox macros are on various slides and not in the Main Module. The
comboBox macros automactically named themselves according to the slide
location For example: Slide5.ComboBox1_Change & Slide5.ComboBox2_Change.

The way my program is set up now is that each combobox has to be run by an
individual action button. The current method dosent pan out so well because
most users forget to click each action button, which leaves the comboboxes
empty. Id like to have the users click one action button that runs all the
comboboxes and then moves to the next slide. Im not sure where to go with
this or if its even possible. Any further suggestions? Thanks in
advance.....

Following are the Macros On Slide 5:

Sub ComboBox1_Change()

If ComboBox1.ListCount < 2 Then
ComboBox1.AddItem ("Proprietary Information")
ComboBox1.AddItem ("Employee Information")
ComboBox1.AddItem ("Customer Information")
ComboBox1.AddItem ("Personal Information")
ComboBox1.AddItem ("Other Information")
End If

End Sub

Sub ComboBox2_Change()
If ComboBox2.ListCount < 2 Then
ComboBox2.AddItem ("Accounting, internal control or auditing")
ComboBox2.AddItem ("Conflict of interest issue")
ComboBox2.AddItem ("Improper purchasing arrangements")
ComboBox2.AddItem ("Alteration of bid procedure")
ComboBox2.AddItem ("Kickback schemes")
ComboBox2.AddItem ("Fraudulent warranty claims/material")
ComboBox2.AddItem ("Falsification of sales records")
ComboBox2.AddItem ("Expense report fraud")
ComboBox2.AddItem ("Attempted theft/defalcation")
ComboBox2.AddItem ("Purposeful destruction of property")
ComboBox2.AddItem ("Reports/discovery of counterfeit/diverted")
ComboBox2.AddItem ("Other potentially fraudulent practices")
End If

End Sub
 
I'm not sure I'm following everything you want to do, but I think you can
solve your problems (at least the ones you describe) by making all your
Private's into Public's. When you create your combo boxes, the procedures
that relate to them are automatically set up as Private. If you want to
run these procedures from other modules, you need to make them Public.
Then you can call a procedure from a Sub in your main module, for
example:

Sub foo()
Slide5.ComboxBox1_Change
End Sub

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Thank you for all your help. It works great! After looking at it from a
different perspective the solution was so easy...I cant believe I was having
such a problem with it! :)

Thanks again for all your help!
 
Back
Top