Previous Document Next Document

Object Model Reference : Classes : G : GMSManager : Methods : GMSManager.RunMacro


GMSManager.RunMacro

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

Description

Member of GMSManager

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

Parameter
Description
ModuleName
Specifies the name of the module
MacroName
Specifies the name of the macro to run
Parameter
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.

This method returns a variant.

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 2013 Corel Corporation. All rights reserved.