HOW TO
The VBA sample in this article demonstrates how to run and pass arguments to a macro using the IVbaApplication::RunVBAMacro command. The arguments are passed using a Variant array.
Code:
Sub RunMacro()
Dim pVbaApp As IVbaApplication
Set pVbaApp = Application
Dim myArray As Variant
'enter name and age
myArray = Array("Jane Doe", 34)
pVbaApp.RunVBAMacro "Project", "Module1", "MyMacro", myArray
End Sub
Sub MyMacro(Name As String, Age As Integer)
MsgBox "Your name is " & Name & " and you are " & Age & " years old."
End Sub
Article ID:000003560
Get help from ArcGIS experts
Download the Esri Support App