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.
|Published (Last):||27 July 2008|
|PDF File Size:||3.87 Mb|
|ePub File Size:||17.47 Mb|
|Price:||Free* [*Free Regsitration Required]|
The add-in model has many more options. This is where the work is done in the VBA sample, and this code needs to be copied and converted. If the ArcGIS templates do not show up when creating a new project, make sure you have. Close the Customize dialog box. Because this article is intended to demonstrate the ease of converting VBA code to.
Paste the subroutine in the code behind. Side-by-side view of VBA code and. After the project is built, the files are bundled as an add-in and automatically installed in ArcMap.
The next fix addresses something that happens a lot when converting code from VBA to. Figure 5 shows the code before and after.
ArcObjects SDK for VBA
One way would be to simply replace the word caption with the word text. 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. This article as a PDF. To set the text to the labels in VBA, the property is called Caption. Most of these will go away once the right references are added. Code vbs with errors and import statements. At the very top of the code for the arcpbjects, above the public class, add three import statements Figure 4.
In this example, it removed the word Set and it put parentheses around the command pFLayer. Go to the Customize menu and pick Add-In Manager Figure 6verify the add-in loaded, and close the dialog box. It must be manually re-created. This opens the County Info dialog box.
However, as demonstrated in the next section, the code is reusable and easily upgraded.
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 added a command button to the project. Migrating VB6 to VB.
In ArcMap, select a county on the map. All the code has been converted for the form. The Customize dialog box. NET, to set the text to the label, the property is called Text. This opens the code for the button. For more information on these topics, see the online help for ArcObjects for.
This is easily fixed by adding import statements at the top of the code. While it might have been easier to just retype Caption to Text, if the correct property is not known, this is a very useful feature. Search the online help for the article “Walkthrough: Drag the My Form Button from Commands and drop it on any toolbar. An error is triggered by ThisDocument. However, note that when pasting the code, Visual Studio did convert some code automatically. Right-click the form created in Visual Studio and pick View Code.
Side-by-side view of VBA form and. This code could be improved. For bva detailed information, Esri has created a very good example. He can be contacted at cgallant ljbinc. Go to the Customize menu and pick Customize Mode.
First wizard screen encountered when creating an add-in.
Now go to the Build menu and build the project. Place the cursor at the end of the word lblCountyName and press the period key.
This example requires two references. There is one other major piece: NET, some of the description of the project creation process is not detailed. You might ask this after installing ArcGIS From the Solution Explorer, right-click FormButton.
Arcobjcets is easy enough to fix. After changing the labels from caption to text, only one error remains. This brings up Intelli-Sense and shows all the properties available to set on the label.
How To: Create a new graticule using VBA and ArcObjects
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. There is one last thing to do before the code is ready to use. It contains counties and states for the entire United States.