Public Sub loadtemplate()
Dim NewTemplateFile As String
NewTemplateFile = "C:\Myermplate.mxt"
Dim pGxFile As IGxFile
Set pGxFile = New GxMap
pGxFile.Path = NewTemplateFile
Dim pGxPageLayout As IGxMapPageLayout
Set pGxPageLayout = pGxFile
Dim pPageLayout As IPageLayout
Set pPageLayout = pGxPageLayout.PageLayout
Dim pMxDoc As IMxDocument
Set pMxDoc = ThisDocument
If Not TypeOf pMxDoc.ActiveView Is IPageLayout Then
Set pMxDoc.ActiveView = pMxDoc.PageLayout
End If
pPageLayout.ReplaceMaps pMxDoc.Maps
Set pMxDoc.PageLayout = pPageLayout
pMxDoc.ActiveView.Refresh
End Sub