The GetPaths VBA macro reports the filenames for the Normal template, the base template, and the current document in ArcMap. The ITemplates::Item property is used to get this information.
How to use
- Paste this code into a module in the Visual Basic Editor for ArcMap.
- Run the GetPaths macro.
- A message box showing the filenames is displayed.
Public Sub GetPaths()
Dim pTemplates As ITemplates
Dim lTempCount As Long
Dim strNormalPath As String
Dim strBasePath As String
Dim strDocPath As String
Set pTemplates = Application.Templates
lTempCount = pTemplates.Count
' Normal is always the first item
strNormalPath = pTemplates.Item(0)
' The document is always the last item
strDocPath = pTemplates.Item(lTempCount - 1)
' If present, the base template is the middle item
If lTempCount = 3 Then
strBasePath = pTemplates.Item(1)
Else
strBasePath = "NO BASE TEMPLATE LOADED"
End If
' Report pathnames
MsgBox "Normal Template: " & strNormalPath & vbNewLine & _
"Base Template: " & strBasePath & vbNewLine & _
"Document: " & strDocPath
End Sub