Use ISpatialReferenceFactory::CreatePredefinedProjections

Last Published: April 25, 2020


Instructions, and the the use of the code sample provided, show how to make a list of all the predefined projections available in ArcGIS using Visual Basic for Applications and ArcObjects.


Follow the steps below.

  1. Open ArcMap.
  2. Open the Visual Basic Editor.

    In ArcMap, select Tools > Macros > Visual Basic Editor.

  3. In the Project Explorer window, expand Project.mxt and select ArcMap Objects > ThisDocument, then right-click and select View Code.
    [O-Image] Visual Basic Project  Explorer
    Code in the project's ThisDocument code module only runs in the current map document. To store the code in all map documents, open the Normal.mxt ThisDocument code module instead.

  4. Paste the following code into the code module:

    Sub ListProjections()
    Dim pSRFactory As ISpatialReferenceFactory
    Set pSRFactory = New SpatialReferenceEnvironment
    Dim pPCSList As ISet
    Set pPCSList = pSRFactory.CreatePredefinedProjections

    Dim pProj As IProjection
    Set pProj = pPCSList.Next
    Do Until pProj Is Nothing
    Debug.Print pProj.Name
    Debug.Print pProj.FactoryCode
    Set pProj = pPCSList.Next

    End Sub

  5. Close the Visual Basic Editor.
  6. Run the code.

    A. Click Tools > Macros > Macros to display the Macros dialog box.
    B. Select a macro and click Run.

Article ID:000004941

  • ArcMap 9 x
  • ArcMap 8 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic