Solved! Go to Solution.
Private Sub UIButtonControl1_Click() ' Call the Test method Test() End Sub
Public Sub Test() ' Put all code here Dim pGP as Object ...... ..... EH: MsgBox pGP.GetMessages(), ...... End Sub
Option Explicit Private Sub UIButtonControl1_Click() ' Call the Test method Test() End Sub Public Sub Test() Dim pGP as Object Set pGP = CreateObject("esriGeoprocessing.GPDispatch.1") On Error GoTo EH pGP.AddToolbox ("D:\DRASTIC_MODEL.tbx") pGP.MyModel MsgBox pGP.GetMessages(), vbOkOnly, "Success" Exit Sub EH: MsgBox pGP.GetMessages(), vbOkOnly, "Error" End Sub
Private Sub UIButtonControl1_Click() Test End SubWithout the braces '(' and ')'.