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"


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

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.

    Dim pPageLayout As esriCarto.IPageLayout

    Set pPageLayout = pMxDocument.PageLayout

    Dim pPage As esriCarto.IPage

    Set pPage = pPageLayout.Page

Article ID:000011449

  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic