Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem w/ AttachTemplate in word document

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
I have 600 word documents that were done incorrectly (headers and footers have same image multiple times). To fix the problem I've created a template with a header and footer as they should be. Then I wrote code to attach the template to the existing documents. Problem is, AttachedTemplate command does seem to work (header and footer are not shown).

What am I doing wrong?

My code looks like this:
Code:
Function FixWordDocs()

    Dim oWord As Word.Application
    Set oWord = New Word.Application
    
    oWord.Documents.Open "test.doc"
    oWord.ActiveDocument.AttachedTemplate = "NewHeaderFooter.dot"
    oWord.Visible = True
    set oWord = Nothing

End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top