I have a button on my toolbar that when clicked, will run a particular model, I have copied the code from here http://resources.esri.com/help/9.3/ArcGISEngine/com_cpp/samples/com/Geoprocessing/5eb001ba-1d6b-4596-b5f8-27c2ad7cb210.htm
But when i click on the button i get the following error. -2147467259 Automation error Unspecified error
My code is as follows
Private Sub LoadExcelToSDE_Click()
On Error GoTo Error:
' Create the geoprocessor
Dim pGp As IGeoProcessor
Set pGp = New GeoProcessor
'Set Overwriteoutput to True
pGp.OverwriteOutput = True
'Add the custom toolbox containing the model tool
'pGp.AddToolbox "H:\Corporate GIS and Web Mapping\Projects\CSY_City_Development \ArcMapPrototype\City_Development.tbx"
pGp.AddToolbox "C:\Documents and Settings\HalilxS\Application Data\ESRI\ArcToolbox\My Toolboxes\City_Development.tbx"
'create the parameter array
Dim pParamArray As IVariantArray
Set pParamArray = New esriSystem.VarArray
'Populate array of paramaters
'pParamArray.Add "H:\Corporate GIS and Web Mapping\Projects\CSY_City_Development\Data\Developers\UK Developers & Contact Details.xlsx\developers$"
pParamArray.Add "C:\Temp\UK Developers & Contact Details.xlsx\developers"
Dim pResult As IGeoProcessorResult
'Execute the model
Set pResult = pGp.Execute("LoadDevelopers", pParamArray, Nothing)
'Get the returned tool messages
ReturnMessages pResult
Error:
MsgBox Err.Number & vbCrLf & Err.Description
End Sub
Public Sub ReturnMessages(ByVal messages As IGeoProcessorResult)
Dim i As Long
Dim message As String
For i = 0 To messages.MessageCount - 1
message = messages.GetMessage(i)
Debug.Print
Next
End Sub
Any ideas on how to fix this, I have tried to change the location of the toolbox and the excel spreadsheet as well but the error still occurs.
I'm using ArcGIS 9.3.1 and VBA
Cheers
Halil
