HOW TO
Instructions below provide an example of how to apply template changes to a map document as the document opens in ArcMap. Note that this code will not work with ArcGIS 9.x. See the Related Information section at the bottom of this document for an alternative method of programmtically changing templates.
Note:
Code in the Project's ThisDocument code module will run when a map document referencing the MXT is opened.
Code:
Private Function MxDocument_OpenDocument() As Boolean
Dim pDoc As IMxDocument
Dim pApp As IApplication
Dim sTemplate As String
' When the MXD is opened, the HEATHER.MXT
' template will be opened.
Set pDoc = ThisDocument
Set pApp = Application
sTemplate = "c:\temp\heather.mxt"
Dim pChangeLayout As IChangeLayout
Set pChangeLayout = pDoc
SendKeys "{TAB}{TAB}{ENTER}" & sTemplate & "{ENTER}{ENTER}", False
pChangeLayout.ChangeLayout
End Function
Article ID:000006318
Get help from ArcGIS experts
Download the Esri Support App