Results 1 to 8 of 8
  1. #1
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Document / template relationship (Word 2000)

    Is it possible to disconnect a document from the template that created it so that macros in the template cannot effect the document when the document is re-opened? If so how? (I hope this makes sense)

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

    Re: Document / template relationship (Word 2000)

    Select Tools | Templates and Add-Ins...
    Clear the Document Template box (or type Normal in it)
    Click OK.

  3. #3
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document / template relationship (Word 2000)

    Thanks Hans for your prompt reply
    Can what you suggested be done within a macro?

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

    Re: Document / template relationship (Word 2000)

    Any of the following instructions will do this:

    ActiveDocument.AttachedTemplate = "Normal"

    ActiveDocument.AttachedTemplate = ""

    ActiveDocument.AttachedTemplate = NormalTemplate

    Note: if you do this in a macro in the original template, macro execution will probably stop immediately after this instruction. See the thread starting at <post#=476477>post 476477</post#>.

  5. #5
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document / template relationship (Word 2000)

    Thanks very much Hans

    I have read post 476477, however, I do not seem to have the problem. I have placed an AutoClose macro in the template that firstly checks that the open document is not the template then if it is a .doc file (which it always is as the macro builds the file name) the line 'ActiveDocument.AttachedTemplate = NormalTemplate' detaches the document from the template. It prompts to save the file but I can live with that for the time being.

    Again, Hans thanks for your time and expertise.

  6. #6
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document / template relationship (Word 2000)

    You won't experience the problem to which Hans alludes, if you're prepared to manually "save changes to document" before closing it. It will only rear its ugly head if you attempt to detach the template, then hope to continue running code to save changes, or whatever else.

    Alan

  7. #7
    Star Lounger
    Join Date
    Sep 2004
    Location
    Sydney, New South Wales, Australia
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Document / template relationship (Word 2000)

    Alan and Hans
    For a novice I must be doing something right. I can detach the template then automatically save the document without crashing. When I check the saved document it has the normal template attached. here is the last bit of code that works for me.
    >>>>>>>>>>>>>>>>>
    ' convert all fields to text...
    Next FF
    ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:="xxxxxx"
    ActiveDocument.AttachedTemplate = NormalTemplate
    If ActiveDocument.Saved = False Then ActiveDocument.Save
    End If
    End If
    End Sub
    >>>>>>>>>>>>>

    Thanks for your help

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

    Re: Document / template relationship (Word 2000)

    As you can see in the thread I referred too, people have varying experiences with detaching a template in code. The code works for me too (Word 2002). I can't explain the difference.

Posting Permissions

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