Previous Document Next Document
GMSManager.RunMacro

Function RunMacro(ModuleName As String, MacroName As String, Parameters() As Variant) As Variant

Member of GMSManager

The RunMacro method runs a function or a subroutine located in another GMS module. This method returns a variant.

Parameters
Description
ModuleName
Specifies the name of the module
MacroName
Specifies the name of the macro to run
Parameters
Represents values that are passed to the function or subroutine that is called. The types and the number of parameters must match those of the function or subroutine that is called. If you call a function, its return value is returned by the RunMacro method.

The following subroutine is contained in the module MyModule, which is part of the GMS file GlobalMacros:

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 

Previous Document Next Document Back to Top

Copyright 2007 Corel Corporation. All rights reserved.