Results 1 to 5 of 5
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    AttachedTemplate (WordXP SP3)

    My current document is attached to a template.
    I want to be able to change the attached template , print, then change the attached template back to its orginial template.

    Will the code below suffice?

    With ActiveDocument
    .UpdateStylesOnOpen = False
    .AttachedTemplate = _
    "Crogram filesmicrosoft officetemplatesLetter.dot"
    End With

    diana

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: AttachedTemplate (WordXP SP3)

    Diana, your code seem to take the first step of changing the attached template. Did you mean to post some additional lines?

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Melbourne, Australia
    Posts
    1,294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: AttachedTemplate (WordXP SP3)

    Apologies Jefferson..heres my code

    'change template
    Dim rngTemplate As Template
    Dim rngTempTemplate As Template
    gbExternalMemo = True
    Set rngTemplate = UCase(BaseLocationForTemplates & "Letter.dot")


    'change template back to orginial
    If gbExternalMemo = True Then

    Set rngTemplate = Nothing
    Set rngTemplate = UCase(BaseLocationForTemplates & "External_Memo.dot")

    End If

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: AttachedTemplate (WordXP SP3)

    Uh-oh, now I'm even more confused. I think you can use simple string variables for the template names. I don't think there's an advantage to creating a template object unless you need to access AutoText entries, etc. My approach would be more like this:

    dim strTemplate1 as string, strTemplate2 as string
    strTemplate1= UCase(BaseLocationForTemplates & "Letter.dot")
    strTemplate2 = UCase(BaseLocationForTemplates & "External_Memo.dot")
    Activedocument.attachedtemplate = strTemplate2
    activedocument.printout
    activedocument.attachedtemplate = strTemplate1

    But I might be missing something significant...

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: AttachedTemplate (WordXP SP3)

    Where is this code stored? In the original template, or in Normal.dot, or a global template, or in the document itself, or ...?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •