2

I am trying to run a geoprocessing tool in ArcGIS 10.2 as a part of a VBA GUI (kind of) that I'm trying to create - unfortunately it gives me an automation error.

I'm new to VBA and ArcGIS.

The complete Error message is: Run-time error '-2147467259 (800040005)' Automation error Unspecified error

Here's the code:

' Make Route Event Layer - used to create points on the line or at an offset

Dim parameters As IVariantArray
Set parameters = New VarArray 

parameters.Add "Address"
parameters.Add "POINT"
parameters.Add "DistRRP"

Dim GP As Object
Set GP = CreateObject("esriGeoprocessing.GpDispatch.1")
GP.MakeRouteEventLayer_lr InSegmentPath, POST_NAME, tablePath, parameters, Output, "Offset"

The Gp.MakeRouteEventLayer line is highlighted when I Debug. Everything after GP.MakeRouteEventLayer_lr are string/names that have been declared and initialized.

I have also used another syntax which gives me the same error:

Dim GP As Object
Set GP = CreateObject("esriGeoprocessing.GpDispatch.1")
GP.MakeRouteEventLayer_lr InSegmentPath, POST_NAME, tablePath, "rkey POINT mile", Output, "Offset"

All of these refer to paths of tables or field names.

  • Welcome to GIS SE! As a new user please take the tour to learn aboout our focused Q&A format. Why are you trying to do this in VBA instead of arcpy or something else that's still fully supported? Is that the entire error message? – Midavalo May 21 '17 at 1:41
  • @Midavalo I'm using a version of ArcMap that has VBA. Also, I've already coded quite a bit - no reason to turn back now. Also, I'm not familiar with ArcPy. The complete Error message is: Run-time error '-2147467259 (800040005)' Automation error Unspecified error – Prieston Lobo May 21 '17 at 1:45
  • I understand you're using a version with VBA, it's still there in 10.4 too, it's just not used much anymore so might make it harder to get help. Also I suggested arcpy as you've already stated "I'm new to VBA" – Midavalo May 21 '17 at 1:48
  • Can you explain your parameters? I can't get into the 10.2 online help, but looking at more recent help I can't make sense of your parameters. – Midavalo May 21 '17 at 1:49
  • Does your other code work using "rkey POINT mile"? That's how I would have presented it rather than in an array ("rkey", "POINT", "mile") although my VBA is very rusty so maybe that's not how an array is passed. – Midavalo May 21 '17 at 1:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.