Results 1 to 12 of 12
  1. #1
    New Lounger
    Join Date
    Dec 2004
    Location
    Adelaide, South Australia, Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Workgroup Templates (Word 2002)

    Another strange mystery of life.
    We use corporate templates over a WAN through a VPN. At each site the templates are on a mapped drive Q:templates. The templates have common names eg document.dot. The dilemma we have is that when opening a template at a remote site, the document is slow to open as it goes off to the originating site to get the template.

    Can anyone offer any advice, please?

    Many thanks John

  2. #2
    2 Star Lounger
    Join Date
    Dec 2003
    Location
    Ossining, New York, USA
    Posts
    114
    Thanks
    4
    Thanked 2 Times in 2 Posts

    Re: Workgroup Templates (Word 2002)

    This may have nothing to do with your problem, but I was intrigued by your statement that the templates have common names. If you have local templates with the same name as workgroup templates (perhaps different versions of the same template in the workgroup location), the local template will always be opened and not the template in the work group. I do not know if this contributes to a delay in accessing the template.

  3. #3
    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: Workgroup Templates (Word 2002)

    Do you need access to the template (e.g., for macros or AutoText entries) once the document is initially created? If not, you can detach the document either as part of the initial step (in, say, an AutoNew macro) or when it is closed (in, say, a FileClose macro). If you need continuing access to the template the next time the document is opened, I think you're stuck.

  4. #4
    New Lounger
    Join Date
    Dec 2004
    Location
    Adelaide, South Australia, Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Workgroup Templates (Word 2002)

    Sorry for the lack of clarity.
    The workgroup templates have common names at each site. ie each site has a template in the Q:templates network directory called document.dot. The hope was for word to go to the local network to find the template, But as yet not to be.

    John

  5. #5
    New Lounger
    Join Date
    Dec 2004
    Location
    Adelaide, South Australia, Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Workgroup Templates (Word 2002)

    I hadn't thought of that approach, (mainly because I'm not a wiz in writing macros), but there is no need for the template to be attached to the document once it is written.

    So the question now is- What would a FileClose macro look like for this approach?

    John

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,805
    Thanks
    4
    Thanked 235 Times in 217 Posts

    Re: Workgroup Templates (Word 2002)

    I am assuming that the mapped Q: drive is on the LAN and not on the remote WAN.

    If a template with the same name is resident in the user's local templates (usually on C: somewhere) or their workgroup templates (should be Q:templates) location then it the word document should open quickly.

    The fact that it is finding the remote template means that Word couldn't find the template locally where it normally looks - and that the template is attached with its UNC path rather than the local mapped drive. If the template was attached as being at Q:templatesdocument.dot rather than at servernamefolder1folder2document.dot then Word wouldn't be looking to the WAN to find the file.

    Of note: If Word cannot find the template in any of the locations it looks, it opens the file quickly. This means these problem files are faster to open if you can pull out the network cable before opening the file and then plug it back in after opening the doc file.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  7. #7
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,805
    Thanks
    4
    Thanked 235 Times in 217 Posts

    Re: Workgroup Templates (Word 2002)

    Is this Q:templates listed as the users Workgroup Templates location?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  8. #8
    New Lounger
    Join Date
    Dec 2004
    Location
    Adelaide, South Australia, Australia
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Workgroup Templates (Word 2002)

    All users at both sites have setup in their tools/option/file locations/Workgroup templates the location of Q:|templates.

    I think this satiisfies what you suggest, but it still seems remarkably slow.

    john

  9. #9
    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: Workgroup Templates (Word 2002)

    The critical line of code to change the template is simply:

    ActiveDocument.AttachedTemplate = NormalTemplate

    Intercepting FileClose is a bit complicated because you have to deal with the possibility that the file needs to be saved. The application-level event DocumentBeforeClose handles the saving or not saving automatically, but requires a number of different modules to be created and so is also messy to code.

    Here's a sample FileClose macro. I do not have time to really test this at the moment, but it will provide something for others to experiment with:
    <pre>Sub FileClose()
    ' Sample only! Not tested!
    With ActiveDocument
    If Not .Saved Then
    Select Case MsgBox("Save this document before closing?", _
    vbQuestion + vbYesNoCancel)
    Case vbYes
    'call Word's built-in Save
    .Save
    'if user saved, then set options, save again, and close doc
    If .Saved Then
    .AttachedTemplate = NormalTemplate
    .Save
    .Close
    End If
    Case vbNo
    'we can close the document, but we can't change the options first
    .Close SaveChanges:=wdDoNotSaveChanges
    Case vbCancel
    'do nothing!
    End Select
    Else
    ' Change options, save, close
    .AttachedTemplate = NormalTemplate
    .Save
    .Close
    End If
    End With
    End Sub
    </pre>

    Hope this helps. (Note: when copying and pasting code from the Lounge, first paste it into a Word document, since Word understands the soft line breaks, but the VB Editor does not and will make a mess of it.)

  10. #10
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Tallahassee, Florida, USA
    Posts
    901
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Workgroup Templates (Word 2002)

    In certain environments (Win2K servers and workstation OS for instance) Word ignores your workgroup drive mappings for the Templates & Add-Ins and resolves to the UNC path. We had this issue and added a private autoclose sub for our templates as the macros were unnecessary once the file had been saved and exited. I'll see if I can get our exact code language thru VBE and post it for you.

    Edited to add: Sorry -- code is lost. We abandoned those templates during a conversion and I don't have a copy of it.
    Karen

  11. #11
    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: Workgroup Templates (Word 2002)

    I forgot about AutoClose! Definitely worth experimenting with to see where it fits in the sequence of events. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  12. #12
    4 Star Lounger
    Join Date
    Dec 2003
    Location
    Zoetermeer, Zuid-Holland, Netherlands
    Posts
    559
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Workgroup Templates (Word 2002)

    We had a similar problem. I could solve that using this code snippet I once found on the net (possibly mvps.org).

    <pre>'Initialise API for network connection
    Declare Function WNetGetConnection Lib "mpr.dll" _
    Alias "WNetGetConnectionA" _
    (ByVal lpszLocalName As String, _
    ByVal lpszRemoteName As String, _
    cbRemoteName As Long) As Long
    </pre>

    <pre>Public Function GetUNCPath(strDrivePath As String) As String
    'strDrivePath = drive-letter + : ( i.e. T: )
    Dim strTemp As String
    Dim lngReturn As Long

    strTemp = Space(255)
    lngReturn = WNetGetConnection(strDrivePath, strTemp, 255)
    If lngReturn = 0 Then
    strTemp = Trim(strTemp)
    GetUNCPath = Left(strTemp, Len(strTemp) - 1)
    Else
    GetUNCPath = "ERROR - " & CStr(lngReturn)
    End If
    End Function
    </pre>


    You use it like this:
    strPath = GetUNCPath("Q:") & "templates"

Posting Permissions

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