PresetColorRamp Sample


This sample demonstrates a tool for creating PresetColorRamps replicating ArcView3.x's predefined color ramps and schemes. A class and form are provided for use in ArcMap's VBA envionment.

How to use:
  1. To replicate ArcView's color ramps, we need to know which colors they contained. The ColorRamps.txt and ColorSchemes.txt files (see below) contain this information, output from an ArcView script. You could make your own files in this format if you have particular ramps you wish to replicate.
  2. Open ArcMap, open the Visual Basic Editor.
  3. Right-click Project in the Project Explorer window, and select Import File. Navigate to the clsRampFile.cls class file and select it.
  4. Repeat this step to import the frmImportColorRamps.frm form file.
  5. Copy-paste the following code into the Project, ThisDocument module:
    Public Sub ImportRamps()
      Load frmImportColorRamps
    End Sub
  6. Exit the VBA Editor. Go to the Tools menu and select Macros. Select the ImportRamps macro from the list (you may have to change the selection in the "Macros In" combo box) and click Run.
  7. In the dialog that appears, enter the path name of the input color ramp information (for example, the ColorRamps.txt provided).
  8. Select the color ramps you wish to import.
  9. Enter a path for the Style file which will contain the ramps, and click Import Ramps. The selected ramps will be created and added to the specified Style file.


Requires: Input files containing color ramp information from ArcView (see below)

Difficulty: Intermediate

Visual Basic
File Description
clsRampFile.cls Code for importing reading a text file and creating a PresetColorRamp
frmImportColorRamps.frm Form file containing the dialog for the tool
txtColorRamps.txt Text file containing information from ArcView 3.x's predefined ColorRamps
txtColorSchemes.txt Text file containing information from ArcView 3.x's predefined ColorSchemes
OutputRamps.txt Text file containing the script used to output ramp information from ArcView 3.x

Key CoClasses: PresetColorRamp
Key Interfaces: IPresetColorRamp