Hello,
Is it possible to start a model (generated from model builder) directly from an ArcMap-Toolbar? I don't want to start the toolbox just for one frequently used tool.
I have 9.3 edition
thanks![]()
Hello,
Is it possible to start a model (generated from model builder) directly from an ArcMap-Toolbar? I don't want to start the toolbox just for one frequently used tool.
I have 9.3 edition
thanks![]()
MOHAMMED HABBOUB - Infrastructure Engineer
Anyone can help?
MOHAMMED HABBOUB - Infrastructure Engineer

The capability of adding your own toolbar and tools (models, scripts, or system tools) is in ArcGIS 10, but not in 9.3. What you can do is to create your own toolbox and add any of the above tools to it. This video shows how:
http://webhelp.esri.com/arcgisdeskto...Spatial_10.htm
Hope that helps.
Dan (Geoprocessing)
Hi,
I have wrote this code, but an error appears (see image):
Option Explicit
Private Sub UIButtonControl1_Click()
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
Exit Sub
EH:
MsgBox pGP.GetMessages(), vbOKOnly, "Test"
End Sub
End Sub
reference: http://support.esri.com/en/knowledge...s/detail/31110
Anyone can help?
MOHAMMED HABBOUB - Infrastructure Engineer

You need to have two Sub or all the code in the Click event. Try this:
First, the Click event method:
The second method (Test) is the worker method:Code:Private Sub UIButtonControl1_Click() ' Call the Test method Test() End Sub
Let us know how it goes.Code:Public Sub Test() ' Put all code here Dim pGP as Object ...... ..... EH: MsgBox pGP.GetMessages(), ...... End Sub
Hi,
Well, I'm not sure that I did it right..
In the first method, I did not get it (how could I call test() method?)... see image "FirstMethod"
In second method, EH error appeared ... see image"Secondmethod"
I know that I'm beginner in VB codes... but I have to learn
Thanks in advance
MOHAMMED HABBOUB - Infrastructure Engineer

Your whole code should like this:
Let us know what message do you get?Code: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
error in "Test()" illustrated in image
MOHAMMED HABBOUB - Infrastructure Engineer

I don't have a VBA compiler right now. If you google with 'how to call a VB sub' you'll get plenty of examples. I guess the call to Test sub should be:
Without the braces '(' and ')'.Code:Private Sub UIButtonControl1_Click() Test End Sub
yes that's right, now both solutions (method 1 and 2) give the same result
MOHAMMED HABBOUB - Infrastructure Engineer

Let's take the issue off the forum. Email me at nahmed@esri.com - we'll post the summary once the issue is resolved. Thanks.
Thanks a lot,![]()
MOHAMMED HABBOUB - Infrastructure Engineer
Hello everybody,
I found a solution for this problem.. in fact it's another code (see image) and it works
reference: http://gis.stackexchange.com/questio...l-arcmap-9-3-1
Thanks a lot, Mr. Nobbir Ahmed![]()
MOHAMMED HABBOUB - Infrastructure Engineer
Bookmarks