Results 1 to 5 of 5
  1. #1
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts

    AttachedTemplate question (Word 2003 SP2)

    Hi all,

    I have a perplexing situation. I'm working with a client that no longer uses the letter template they used to have. The new one is in a different location. All documents created with the old template point to that template when you look in Tools > Templates and add-ins.

    Since the template is missing, the document is actually attached to Normal, so if I query the AttachedTemplate, I get "Normal" rather than the string that's displayed in the dialog. Is there any way to capture that text? This would allow me to qualify a document as an old letter and manipulate it accordingly (such as attaching it to the new letter template, which resides in another folder).

    I can't move/rename the new template. I could create a bogus letter template in the old location, just for the sake of capturing the string, but I'd rather not do something so messy if there's another way. Anybody? <img src=/S/hairout.gif border=0 alt=hairout width=31 height=23>

    Thanks!
    Kim

  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 question (Word 2003 SP2)

    The information appears in three different dialogs, but one does not have the full path. These are formatted from the Immediate window, but you get the idea:
    <hr><code>?Activedocument.AttachedTemplate
    Normal.dot

    ?dialogs(wdDialogToolsTemplates).template
    Cocuments and SettingsusernameDesktopTemplateUno.dot

    ?dialogs(wdDialogFileSummaryInfo).template
    Cocuments and SettingsusernameDesktopTemplateUno.dot

    ?activedocument.BuiltInDocumentProperties("Templat e")
    TemplateUno.dot</code><hr>
    I don't know what object creation/destruction overhead is involved in using the dialogs collection this away, but a similar approach was a common practice in WordBasic, so hopefully it has been optimized from the beginning. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  3. #3
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts

    Re: AttachedTemplate question (Word 2003 SP2)

    Jefferson, thanks!

    I used this code to query the (detached) AttachedTemplate name:
    <pre>Sub DetermineOriginalAttachedTemplate()
    Dim strTempName
    strTempName = Dialogs(wdDialogToolsTemplates).Template
    MsgBox "The Template is " & strTempName, vbOKOnly, "Tah-Dah!"
    End Sub</pre>

    This worked like a charm. I don't know the overhead, either, but it was fast and accurate. Now I'll incorporate in my bigger picture code.

    A sidenote is that I have Auto List Members turned on in VBE Options, but "Template" did not appear as a property list member for either dialog box. Still, it worked and what more can I ask?

    Thanks again, <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>
    Kim

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

    Re: AttachedTemplate question (Word 2003 SP2)

    The arguments for built-in dialogs are not exposed in the Object Browser. But you can look them up in the help subject 'arguments for built-in dialogs', or in the Word 95 WordBasic Help File (yes, it's still valid)

  5. #5
    5 Star Lounger kmurdock's Avatar
    Join Date
    Feb 2003
    Location
    Pacific Grove, California, USA
    Posts
    716
    Thanks
    10
    Thanked 34 Times in 28 Posts

    Re: AttachedTemplate question (Word 2003 SP2)

    Thank you Hans,

    Very helpful. I learn something new every day (and thank goodness for that). <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

    Kim

Posting Permissions

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