ERROR

Error 13: Type mismatch

Last Published: April 25, 2020

Error Message


[O-Image] Singapore
This article was contributed by Esri Singapore.

VBA code that was created in ArcGIS 9.3 may return the following error in ArcGIS 10.

"Error 13: Type mismatch"

Cause

When code created with ArcGIS 9.3 contains the following lines and is run in ArcGIS 10, a mismatch error is returned.

Code:
Public Sub Run()

Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument

Dim pPageLayout As IPageLayout
Set pPageLayout = pMxDoc.PageLayout

Dim pPage As IPage
Set pPage = pPageLayout.Page '** error occurs here **

End Sub

Solution or Workaround



  1. Verify that the references to the esriCarto and esriCartoUI libraries have been given from Tools > References in the VB editor.
    They should be pointing to '<ArcGIS installation folder>\com\esriCarto.olb' and '<ArcGIS installation folder>\com\esriCartoUI.olb', respectively.

    If needed, correct the library references to these paths (default setting).
  2. If the error continues to occur after verifying the reference libraries, fully qualify the interfaces in the code.

    Code:
    Dim pPageLayout As esriCarto.IPageLayout

    Set pPageLayout = pMxDocument.PageLayout

    Dim pPage As esriCarto.IPage

    Set pPage = pPageLayout.Page

Article ID:000011449

Software:
  • ArcMap

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