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):||1 September 2014|
|PDF File Size:||16.39 Mb|
|ePub File Size:||2.76 Mb|
|Price:||Free* [*Free Regsitration Required]|
The Esri online help is very useful. While it might have been easier to just retype Caption to Text, if arrcobjects correct property is not known, this is a very useful feature.
How To: Create a new graticule using VBA and ArcObjects
An error is triggered by ThisDocument. Go to the error lblCountyName. In this example, it removed the word Set and it put parentheses around the command pFLayer.
NET, some of the description of the project creation process is not detailed.
ArcGIS Desktop Help – Sample VBA code
However, note that when pasting the code, Visual Studio did convert some code automatically. Scroll down and pick the word Text. When all errors are fixed, Visual Studio displays the warning error “‘pFCursor’ is passed before it is assigned.
With a county selected, click the Read Data button on the dialog box. Paste the subroutine in the code behind. Place the cursor at the end of the word lblCountyName and press the period key. Go to the Customize menu and pick Add-In Manager Figure 6verify the add-in loaded, and close the dialog box. This article as a PDF. Another way demonstrates one of the benefits of using the Visual Studio environment.
After the project is built, the files are bundled as an add-in and automatically installed in ArcMap.
NET, to set the text to the label, the property is called Text. This will read the vha county information and display it on the form. They are authored in.
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. Side-by-side view of VBA form and.
To set the text to the labels in VBA, the property is called Caption. You might ask arcojbects after installing ArcGIS Choose Add-In Controls from Categories the category that was defined when creating the add-in.
This added a command button to the project.
It must be manually re-created. The Add-In Manager dialog box. To fix this error, change ThisDocument to My. This opens the County Info dialog box. This is easy enough to fix. Figure 5 shows the code before and after. The Customize dialog box. Not much has arcobkects in the conversion between VBA and the add-in.
In the OnClick event, add the following arocbjects lines:. First wizard screen encountered when creating an add-in. Drag the My Form Button from Commands and drop it on any toolbar. An easy way to do this is to export the form to be upgraded out of the VBA editor and open the vga file with the. The add-in model has many more options. Second wizard screen for creating command button. Doing this lets Visual Studio use the shorter names also.
This is where the work is done in the VBA sample, and this code needs to be copied and converted. When the code is pasted, several errors will show up.
After changing the labels from caption to text, only one error remains. Now go to the Build menu and build the project. That’s it for converting the code. Copy the subroutine and paste it into the newly created form in the add-in project.
This example requires two references. There is one other major piece: This brings up Intelli-Sense and shows all the properties available to set on the label. The next fix addresses something that happens a lot when converting code from VBA to. The VBA sample for this exercise is a simple form that reads xrcobjects selected county on the map and displays its information on the form. If the ArcGIS templates do not show up when creating a new project, make sure you have.
There is one last thing to do before the code is ready to use. Arcobjeects more information on these topics, see the online help for ArcObjects for. In ArcMap, select a county on the map.