HOW TO
Instructions provided describe steps to programmatically change layout templates in ArcMap using ArcObjects.
Note:
Code in the Project's ThisDocument code module will only run in the current map document. If you want to store the code in all your map documents open the Normal.mxt ThisDocument code module instead.
Code:
Sub SwitchLayout()
Dim pGxFile As IGxFile
Set pGxFile = New GxMap
pGxFile.Path = "C:\arcgis\Bin\Templates\USA\centralusa.mxt"
Dim pGxPageLayout As IGxMapPageLayout
Set pGxPageLayout = pGxFile
Dim pPageLayout As IPageLayout
Set pPageLayout = pGxPageLayout.PageLayout
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
pPageLayout.ReplaceMaps pMxDoc.Maps
Set pMxDoc.PageLayout = pPageLayout
End Sub
Article ID:000007581
Get help from ArcGIS experts
Download the Esri Support App