Skip to main content
added 143 characters in body
Source Link
Zachary
  • 6.2k
  • 5
  • 34
  • 51

This code will run existing tools or models that your create:

Private Sub opentool_Click()
'Ensure that there are references set to the
'ESRI GeoprocessingUI Object Library and the
'ESRI Geoprocessing Object Library.
'Go to Tools > References to do this

Dim pUID As New UID
pUID = "esriGeoprocessingUI.ArcToolboxExtension"

Dim pATBExt As IArcToolboxExtension
Set pATBExt = Application.FindExtensionByCLSID(pUID)

Dim pAtb As IArcToolbox
Set pAtb = pATBExt.ArcToolbox

Dim pTool As IGPTool

'* Use this line for custom tools or models
'* ========================================
Set pTool = pAtb.GetToolbyNameString("Model8")

'* Use this line for existing tools
'* ================================
'Set pTool = pAtb.GetToolbyNameString("buffer_analysis")

Dim pCommand As IGPToolCommandHelper
Set pCommand = New GPToolCommandHelper
pCommand.SetTool pTool
pCommand.Invoke Nothing

End Sub

Right click on your tool in ArcToolox and go to properties to find the model name. alt text

This code will run existing tools or models that your create:

Private Sub opentool_Click()
'Ensure that there are references set to the
'ESRI GeoprocessingUI Object Library and the
'ESRI Geoprocessing Object Library.
'Go to Tools > References to do this

Dim pUID As New UID
pUID = "esriGeoprocessingUI.ArcToolboxExtension"

Dim pATBExt As IArcToolboxExtension
Set pATBExt = Application.FindExtensionByCLSID(pUID)

Dim pAtb As IArcToolbox
Set pAtb = pATBExt.ArcToolbox

Dim pTool As IGPTool

'* Use this line for custom tools or models
'* ========================================
Set pTool = pAtb.GetToolbyNameString("Model8")

'* Use this line for existing tools
'* ================================
'Set pTool = pAtb.GetToolbyNameString("buffer_analysis")

Dim pCommand As IGPToolCommandHelper
Set pCommand = New GPToolCommandHelper
pCommand.SetTool pTool
pCommand.Invoke Nothing

End Sub

This code will run existing tools or models that your create:

Private Sub opentool_Click()
'Ensure that there are references set to the
'ESRI GeoprocessingUI Object Library and the
'ESRI Geoprocessing Object Library.
'Go to Tools > References to do this

Dim pUID As New UID
pUID = "esriGeoprocessingUI.ArcToolboxExtension"

Dim pATBExt As IArcToolboxExtension
Set pATBExt = Application.FindExtensionByCLSID(pUID)

Dim pAtb As IArcToolbox
Set pAtb = pATBExt.ArcToolbox

Dim pTool As IGPTool

'* Use this line for custom tools or models
'* ========================================
Set pTool = pAtb.GetToolbyNameString("Model8")

'* Use this line for existing tools
'* ================================
'Set pTool = pAtb.GetToolbyNameString("buffer_analysis")

Dim pCommand As IGPToolCommandHelper
Set pCommand = New GPToolCommandHelper
pCommand.SetTool pTool
pCommand.Invoke Nothing

End Sub

Right click on your tool in ArcToolox and go to properties to find the model name. alt text

Source Link
Zachary
  • 6.2k
  • 5
  • 34
  • 51

This code will run existing tools or models that your create:

Private Sub opentool_Click()
'Ensure that there are references set to the
'ESRI GeoprocessingUI Object Library and the
'ESRI Geoprocessing Object Library.
'Go to Tools > References to do this

Dim pUID As New UID
pUID = "esriGeoprocessingUI.ArcToolboxExtension"

Dim pATBExt As IArcToolboxExtension
Set pATBExt = Application.FindExtensionByCLSID(pUID)

Dim pAtb As IArcToolbox
Set pAtb = pATBExt.ArcToolbox

Dim pTool As IGPTool

'* Use this line for custom tools or models
'* ========================================
Set pTool = pAtb.GetToolbyNameString("Model8")

'* Use this line for existing tools
'* ================================
'Set pTool = pAtb.GetToolbyNameString("buffer_analysis")

Dim pCommand As IGPToolCommandHelper
Set pCommand = New GPToolCommandHelper
pCommand.SetTool pTool
pCommand.Invoke Nothing

End Sub