I have a password protected macro that works great by itself. I created my own macro but need to call that protected one first. Trying to get by without having to hit two macros to get the end result.
Myron,
You can use GMSManager.RunMacro to do this:
GMSManager.RunMacro
Function RunMacro(ModuleName As String, MacroName As String, Parameter() As Variant) As Variant
Here is the example from the help file:
Sub MyTestSub() MsgBox "Hello world!" End Sub Sub Test() GMSManager.RunMacro "GlobalMacros", "MyModule.MyTestSub" End Sub 'The following function is contained in the module "MyModule" which is part of the GMS file "GlobalMacros." Function Multiply(x As Double, y As Double) As Double Multiply = x * y End Function Sub Test() Dim v As Double v = GMSManager.RunMacro("GlobalMacros", "MyModule.Multiply", 4, 7) MsgBox "4 * 7 = " & v End Sub
Hopefully that helps,
-Shelby
Not having much luck with it.
The protected macro I'm trying to call doesn't fall under GlobalMacros
Tried many different variables but can't get it to call the macro I need after after doing my macro
It does not have to be GlobalMacros, you just need the ModuleName. So Here is an example of my GMS:
And I can call it from somewhere else like this:
Sub TryThis1() GMSManager.RunMacro "ASampleGMS", "Macros.SayHello" End Sub
Hope that helps,