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):||18 May 2015|
|PDF File Size:||3.98 Mb|
|ePub File Size:||15.24 Mb|
|Price:||Free* [*Free Regsitration Required]|
The next fix addresses something that happens a lot when converting code from VBA to. This added a command button to the project.
Code view with errors and import statements. 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. Choose Add-In Controls from Categories the category that was defined when creating the add-in.
This opens the code for the button. This is where the work is done in the VBA sample, and this code needs to be copied and converted.
An error is triggered by ThisDocument. 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. Click the button to show the county form that was just dragged to the toolbar.
Vvba is easy enough to fix. If the ArcGIS templates do not show up when creating a new project, make sure you have. First wizard screen encountered when creating an add-in.
In the Customize dialog box, click the Commands tab Figure 7. Side-by-side view of VBA code and.
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. Go to the Customize menu and pick Add-In Manager Figure 6verify the add-in loaded, and close the dialog box.
ArcGIS Desktop Help – Sample VBA code
After changing the labels from caption to text, only one error remains. All the code has been converted for the form. Figure 5 shows the arclbjects before and after. Drag the My Form Button arcbjects Commands and drop it on any toolbar. In this example, it removed the word Set and it put arcobbjects around the command pFLayer. There is one other major piece: With a county selected, click the Read Data button on the dialog box.
Go to the error lblCountyName. This is easily fixed by adding import statements at the top of the code. In ArcMap, select a county on the map. Now go to the Build menu and build the project. Most of these will go away once the right references are added. This code could be improved. This brings up Intelli-Sense and shows all the properties available to set on the label.
Go to the Customize menu and pick Customize Mode. There is one last thing to do before the code is ready to use.
How To: Create a new graticule using VBA and ArcObjects
Close the Customize dialog box. At the very top of the code for the arcobject, above the public class, add three import statements Figure 4. When the code is pasted, several errors will show up. They are authored in.