In this topic
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
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.
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.
You don't have to use VBA to create custom commands and toolbarsin fact,
in some cases, your custom commands and toolbars may require you to use
another development environment. You can create custom objects in any
programming language that supports the
Microsoft® Component Object Model. Custom
commands or toolbars created outside VBA are often distributed as ActiveX DLLs.
If you have created some custom commands and toolbars, or someone else has
given you an ActiveX DLL containing custom commands and toolbars, you can
easily add these objects to ArcMap or ArcCatalog. After adding a custom object
to ArcMap or ArcCatalog, you can use it as you would any built-in command
If you want to use a programming language other than VBA, or if you want to package ArcObjects functionality into a COM DLL, EXE, OCX, or .NET assembly, you will have to work outside the VBA development environment. This approach generally requires creating a project, referencing the ArcObjects type libraries required, implementing ArcObjects interfaces, adding code, then compiling the source into a binary file.
Following are some advantages of building custom components:
- They can be easily delivered to end users via custom setup programs.
- You can hide your code and logic in a binary file.
- You can extend and customize virtually every aspect of the ArcGIS technology.
Components can be broadly categorized into two areas of customization:
those that reside at the application level, such as custom buttons, toolbars,
windows, and extensions, and those that reside at the
geodatabase level, such as custom feature class extensions and features. Some of these more
advanced customizations cannot be accomplished through the VBA environment.