English

How To: Run AML ARC commands from ArcCatalog or ArcMap

Summary

Create VBA code with the ODE references 'ESRI Arc automation server' and 'ESRIutil automation server' and run an AML using the Command method.

Procedure

  1. Open the VBA editor in ArcMap.
  2. In the VBA editor Tools menu, click References.
  3. Check the 'ESRI Arc automation server' and 'ESRIutil automation server'.
  4. Instantiate an ODE ESRI.Arc object and an ESRIutil.Strings object.

    Code:
    Dim Arc1 As ESRI.Arc
    Dim Results As ESRIutil.Strings
    Set Results = New ESRIutil.Strings
    Set Arc1 = New ESRI.Arc

  5. Send the &RUN directive to the ESRI Arc automation server through the Command method of the ESRI.Arc object.

    Code:
    Dim ArcStatus As Long
    Dim command1 As String
    command1 = "&run c:\testdir\demo.aml"
    ArcStatus = Arc1.Command(command1, Results)
    MsgBox "AML complete."

    Note:
    AML's that switch to other modules such as Tables or Arcedit, require a different VBA coding strategy.

Related Information