Textbox in Header problem

B

Brent B.

I have a letterhead template that has a text box inserted and locked in
position outside of the bounding area of the header area that holds the
company logo. When I copy the original documents primary header and paste it
into the new letterhead document, the textbox logo is gone. This is how I'm
trying it.

Original document is active -
activedocument.StoryRanges(wdPrimaryHeaderStory).Copy

I make the new document active -
activedocument.StoryRanges(wdPrimaryHeaderStory).Paste

The text contained in the original document shows up in the new document's
header but the textbox logo is gone.

Any thoughts?

Thanks,
Brent
 
C

Charles Kenyon

Are you sure that your textbox is anchored in the header rather than on page
1 of the body of your document? Does it show up as faded when you are not
viewing the header/footer? I routinely copy a header that includes a textbox
using code, but the textbox is anchored inside a bookmark and it is the
bookmark contents that are copied. The following is my code, hope it helps.

Private Sub ReplaceHeaders(sTemplateName As String)
' Altered to delete ranges 28 March 2004
'
' Replaces Header and FirstPageHeader with contents from
' base template
' Replaces Footer and FirstPageFooter with contents from
' base template
' Assumes that bookmarks have been preserved in base and copies.
' Otherwise will generate error
' Required bookmarks are "Footer1," "Footer2," "Header1," and
"Header2"
'
Dim rRange As Range
Dim sFooter As String
Dim sHeader As String
Dim iCount As Integer
'
' For iCount = 1 To 1 ' Replace 1st page header/footer only
For iCount = 1 To 2 ' Replace both headers, letterhead & continuation
sFooter = "Footer" & iCount
sHeader = "Header" & iCount
Set rRange = ActiveDocument.Bookmarks(sHeader).Range
rRange.Delete
rRange.InsertFile FileName:=WorkGroupPath _
& "Letters & Faxes\" & sTemplateName, _
Range:=sHeader, _
ConfirmConversions:=False, Attachment:=False, Link:=False
Set rRange = ActiveDocument.Bookmarks(sFooter).Range
rRange.Delete
rRange.InsertFile FileName:=WorkGroupPath _
& "Letters & Faxes\" & sTemplateName, _
Range:=sFooter, _
ConfirmConversions:=False, Attachment:=False, Link:=False
Next iCount
End Sub

Function WorkGroupPath() As String
' Written by Charles Kenyon
' February 28, 2003
'
' Used by templates menus to set location of templates.
' Returns workgroup tempates path with "\" at the end.
'
' This is needed because if the folder is a network drive rather
' than a folder, it will have the "\" already. If it is a folder,
' it will not have the backslash. This function gives a string
' with the backslash in either case.
'
WorkGroupPath =
Application.Options.DefaultFilePath(wdWorkgroupTemplatesPath)
If Right(WorkGroupPath, 1) <> "\" Then
WorkGroupPath = WorkGroupPath & "\"
End If
End Function

--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top