D
DianneZ
Hello!
I am trying to write a macro to insert a header with one of the standard
building block entry headers in the quick parts list.
When I try, I get the error messge 5941. From reading other posts I can tell
it cannot find the building blocks template - this is confusing since they
are the default entries and I can use them while not in a macro - so it would
seem word knows where the building blocks template is. hmm .... help would
be so appreciated.
Here is the code:
Sub insert_header2()
'
' insert_header2 Macro
' dianne recorded
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
-----HANGS UP ON THE LINE BELOW------
ActiveDocument.AttachedTemplate.BuildingBlockEntries("Alphabet").Insert _
Where:=Selection.Range, RichText:=True
Selection.TypeText Text:="Axolotl header"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
I am trying to write a macro to insert a header with one of the standard
building block entry headers in the quick parts list.
When I try, I get the error messge 5941. From reading other posts I can tell
it cannot find the building blocks template - this is confusing since they
are the default entries and I can use them while not in a macro - so it would
seem word knows where the building blocks template is. hmm .... help would
be so appreciated.
Here is the code:
Sub insert_header2()
'
' insert_header2 Macro
' dianne recorded
'
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
-----HANGS UP ON THE LINE BELOW------
ActiveDocument.AttachedTemplate.BuildingBlockEntries("Alphabet").Insert _
Where:=Selection.Range, RichText:=True
Selection.TypeText Text:="Axolotl header"
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub