Compile Error: User-defined type not defined

Last Published: April 25, 2020

Error Message

When running VBA code within ArcMap or ArcCatalog that includes references to Network Analyst objects, you get the following error message when you attempt to run the code:
'Compile error: User-defined type not defined'


esriNetworkAnalyst.olb and esriNetworkAnalystUI.olb are not included in the VBA list of references.

Solution or Workaround

You need to include references to the Network Analyst OLB files.

  1. Within VBA, click on Tools > References to show the References dialog box.
  2. Check on the references 'ESRI Network Analyst Object Library' and 'ESRI NetworkAnalystUI Object Library'.
  3. Click OK to dismiss the dialog.
  4. Re-run the VBA code.

Article ID:000007854

  • ArcMap 9 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options