In this topic
Customizing ArcGIS Desktop applications
You may want the ArcMap and ArcCatalog interfaces to reflect your own preferences and the way you work.
You can customize ArcMap and ArcCatalog in many ways. Here are some examples:
-
Position toolbars in a specific area of the application.
-
Group commands in a way that works best for you.
-
Add new macros or load custom commands from another source.
-
Always work with the same geographic data (via templates).
If you work in a larger organization, others may want you to develop a customized work environment for them. You can handle many customization tasks without writing a single line of code. In fact, you may be able to instruct others on how to use the customization environment to create the look and feel they want on their own. You can change or create toolbars, menus, shortcut keys, and so on, to help you do your work in the most efficient way. You can provide additional functionality by linking code you or others have written to menu commands or tools.
Several toolbars are provided with ArcMap and ArcCatalog, but you may want to create new toolbars to organize commands that you often use together or to contain buttons that run your custom scripts.
The Customize dialog box is used to create new toolbars and add or remove controls.
Writing VBA macros in ArcGIS applications
Both ArcMap and ArcCatalog come with Visual Basic® for Applications (VBA). VBA is not a standalone program; it's embedded in the applications. It provides an integrated programming environment, the Visual Basic Editor (VBE), which lets you write a Visual Basic (VB) macro, then debug and test it right away in ArcMap or ArcCatalog. A macro can integrate some or all of VB's functionality, such as using message boxes for input, with the extensive object library that ArcMap and ArcCatalog expose. The ESRI object libraries are always available to you in the VBA environment.
There is an easy way to create custom commands with VBA. You can create a new button, tool, combo box, or edit box (collectively called UIControls), then attach code to the control's events, such as what happens when you click a button. After you have created it, you can drag this new control onto a toolbar.
A buffer command created in VBA
As mentioned, you should start development by using the VBA environment in one of the existing ArcGIS applications. VBA is a simple programming language with many utilities, such as design time code completion and the Object Browser that will help you assemble code quickly.
Here are more reasons to choose the VBA environment:
-
It's fast and easy to create, test, and debug macros inside ArcMap and ArcCatalog.
-
The standard ESRI type libraries are already referenced for you.
-
Important global variables, such as the Application and Document, are available.
-
It's simple to assemble UI forms using VBA and ActiveX® components.
-
It's straightforward to integrate VBA code with new ArcObjects UIControls.
-
It's relatively easy to migrate VBA code to VB ActiveX Dynamic Link Library (DLL) projects.
-
Many code samples available in the help system are macros that can be cut, pasted, and run within the VBA environment.