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: Nikora Kalrajas
Country: Kazakhstan
Language: English (Spanish)
Genre: Life
Published (Last): 24 October 2012
Pages: 337
PDF File Size: 8.68 Mb
ePub File Size: 15.13 Mb
ISBN: 330-3-64229-190-7
Downloads: 73667
Price: Free* [*Free Regsitration Required]
Uploader: Kazigor

It must be manually re-created. Search the online arcobuects for the article “Walkthrough: This is really the only major error in converting the code. The next fix addresses something that happens a lot when converting code from VBA to.

Side-by-side view of VBA code and. From the Solution Explorer, right-click FormButton. For more information on these topics, see the online help for ArcObjects for. The Esri online help is very useful.

To fix this error, change ThisDocument to My. Side-by-side view of VBA form and.

cba Go to the Customize menu and pick Customize Mode. Drag the My Form Button from Commands and drop it on any toolbar. Choose Add-In Controls from Categories the category that was defined when creating the add-in. They are authored in.

Migrating VB6 to VB. Copy the subroutine and paste it into the newly created form in the add-in project. 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. He can be contacted at cgallant ljbinc. This is where the work is done in the VBA sample, and this code needs to be copied and converted.


How To: Create a new graticule using VBA and ArcObjects

When the add-in project was created, the Button checkbox was checked. The Add-In Manager dialog box. There is one last thing to do before the code is ready to use. However, as demonstrated in the next section, the code is reusable and easily upgraded. In this example, it removed the word Set and it put parentheses around the command pFLayer. 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.

You need to pick the option that best suits your application.

How To: Create a new graticule using VBA and ArcObjects

This opens the code for the button. Now go to the Build menu and build the project. Close the Arcobjeccts dialog box. This added a command button to the project. All the code has been converted for the form.

This brings up Intelli-Sense and shows all the properties available to set on the label. An error is triggered by ThisDocument. After the project is built, the files are bundled as an add-in and automatically installed in ArcMap. Paste the subroutine in the code behind. This example requires two references. In the OnClick event, add the following two lines:.

For more detailed information, Esri has created a very good example. Scroll down and pick the word Text. Doing this lets Visual Studio use the shorter names also. Go to the Customize menu and pick Add-In Manager Figure 6verify the add-in loaded, and close the dialog box.


Second wizard screen for creating command button. This is easily fixed by adding import statements at the top of the code.

With a county selected, click the Read Data button on the dialog box. They provide a declaratively based framework for creating a collection of customizations that can be conveniently packaged in a single compressed file that is easily shared.

This code could be improved. 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.

Code view with errors and import statements. An easy way to do this is to export the form to be upgraded out of the VBA editor and open the exported file with the. After changing the labels from caption to text, only one error remains. Not much has changed in the conversion between VBA and the add-in. To set the text to the labels in VBA, the property is called Caption.

The Customize dialog box. This is easy enough to fix. When the code is pasted, several errors will show up.