May 23, 2019 posted by

How To: Create a new graticule using VBA and ArcObjects. Summary. This article shows how to create a new graticule and set its properties in ArcMap. You might ask this after installing ArcGIS With the release of ArcMap 10, Visual Basic for Applications (VBA) is on the way out. As the online help article. Customizing and developing with ArcGIS > Writing macros using VBA the ArcGIS Desktop Developer Guide, or from Exploring ArcObjects.

Author: Vuzragore Mazurr
Country: Ecuador
Language: English (Spanish)
Genre: Relationship
Published (Last): 4 August 2012
Pages: 360
PDF File Size: 2.37 Mb
ePub File Size: 13.69 Mb
ISBN: 233-7-91409-673-3
Downloads: 12877
Price: Free* [*Free Regsitration Required]
Uploader: Mezit

Copy the subroutine and paste it into the newly created form in the add-in project.

In the OnClick event, add the following two lines:. Drag the Arcobmects Form Button from Commands and drop it on any toolbar.

An error is triggered by ThisDocument.

He can be contacted at cgallant ljbinc. When all errors are fixed, Visual Studio displays the warning error “‘pFCursor’ is passed before it is assigned. All the code has been converted for the form. Go to the Customize menu and pick Customize Mode.

The Customize dialog box. When the code is pasted, several errors will show up. After changing the labels from caption to text, only one error remains. Paste the subroutine in the code behind. After the project is built, the files are bundled as an add-in and automatically installed in ArcMap. You need to pick the option that best suits your application. The Esri online help is very useful. Most of these will go away once the right references are added.


Another way demonstrates one of the benefits of using the Visual Studio environment.

For more detailed information, Esri has created a very good example. You might ask this after installing ArcGIS It contains counties and states for the entire United States. The VBA sample for this exercise is a simple form that reads the selected county on the map and displays its information on the form. This brings up Intelli-Sense and shows all the properties available arobjects set on the label.

It must be manually re-created. This article as a PDF.

There is one other major piece: However, note that when pasting the code, Visual Studio did convert some code automatically.

In the Customize dialog box, click the Commands tab Figure 7. Not much has changed in the conversion between VBA and the add-in. This is easy enough to fix.

ArcGIS Desktop Help – Sample VBA code

In conclusion, even though VBA is gone, with a little refactoring and a good bit of copying and pasting, existing VBA code can be reused in the new. Just adding the references won’t fix the problems because the code that was copied worked in VBA because the VBA editor understood the shorter names for ArcObjects.


This opens the code for the button. Click the button to show the county form that was just dragged to the toolbar. This added a command button to the project.

How To: Create a new graticule using VBA and ArcObjects

Figure 5 shows the code before and after. Because arcobjjects article is intended to demonstrate the ease of converting VBA code to.

This opens the County Info dialog box. From the Solution Explorer, right-click FormButton. One way would be to simply replace the word caption with the word text. When the add-in project was created, the Button checkbox was checked.

How To: Create a new graticule using VBA and ArcObjects

NET, to set the text to the label, the property is called Text. This example requires two references. To fix this error, change ThisDocument to My. Search the online help for the article “Walkthrough: Side-by-side view of VBA code and. Va it might have been easier to just retype Caption to Text, if the correct property is not known, this is a very useful feature.