clhare
01-08-2007, 07:27 AM
Hello...
I need to insert an AutoText entry into just the headers for Section 1. The document has "different first page" selected in the setup, so there's going to be two headers I have to add the AutoText entry to. Can someone tell me how to do that? The following is as close as I can get, but it's not right and I don't know how to fix it.
Dim intHFType As Integer
Dim rngSelection As Range
Dim rngPane As Range
With ActiveDocument.Sections(1)
For intHFType = 1 To 3 ' Starting with the first header
Set rngPane = .Headers(intHFType).Range
With rngPane
ActiveDocument.AttachedTemplate.AutoTextEntries("MyAutoText").Insert Where:= _
Selection.Range, RichText:=True
ActiveWindow.ActivePane.View.NextHeaderFooter
Application.DisplayAutoCompleteTips = True
ActiveDocument.AttachedTemplate.AutoTextEntries("MyAutoText").Insert Where:= _
Selection.Range, RichText:=True
End With
Next intHFType
End With
Any help would be greatly appreciated!
I need to insert an AutoText entry into just the headers for Section 1. The document has "different first page" selected in the setup, so there's going to be two headers I have to add the AutoText entry to. Can someone tell me how to do that? The following is as close as I can get, but it's not right and I don't know how to fix it.
Dim intHFType As Integer
Dim rngSelection As Range
Dim rngPane As Range
With ActiveDocument.Sections(1)
For intHFType = 1 To 3 ' Starting with the first header
Set rngPane = .Headers(intHFType).Range
With rngPane
ActiveDocument.AttachedTemplate.AutoTextEntries("MyAutoText").Insert Where:= _
Selection.Range, RichText:=True
ActiveWindow.ActivePane.View.NextHeaderFooter
Application.DisplayAutoCompleteTips = True
ActiveDocument.AttachedTemplate.AutoTextEntries("MyAutoText").Insert Where:= _
Selection.Range, RichText:=True
End With
Next intHFType
End With
Any help would be greatly appreciated!