Results 1 to 9 of 9
  1. #1
    Star Lounger
    Join Date
    Aug 2001
    Location
    Hampshire, England
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Template with code and user form, runs slow.... (Wd 2003)

    Hi all,

    I have a template (which my teammates all have a local copy of, in their User Templates location) that pops up a form when a document based on that template is opened or created. The form has some list boxes that are populated from a plain text file on a shared network drive that we all use. Then the form is used to fill some document properties and fields in the document.

    Originally, the template worked fine and the form would pop up straight away, but recently it has become very slow. You open/create the document and nothing happens. Eventually, and sometimes after a bit of prompting by clicking on the page, the form will pop up, but my colleagues are getting a bit frustrated with the wait!

    After that initial delay, if you need to re-open the form (accessed by a toolbar button) it DOES come up at the expected full speed; it's just at document launch that it seems to take ages.

    Any ideas why this used to work speedily and has become slow?

  2. #2
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    Sounds like a network problem. Just a guess.

    If information in the text file is not being changed moment to moment but is simply a resource, why not distribute it locally at login.
    Charles Kyle Kenyon
    Madison, Wisconsin

  3. #3
    Star Lounger
    Join Date
    Aug 2001
    Location
    Hampshire, England
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, it certainly seems that if I make a local copy of the text file, and change the code in the template so that it looks at that instead of the networked one, then it launches quickly again. Hm.
    The plain text file does get updated occasionally; but only on an every-few-months basis. I could get away with giving everyone a new copy of that each time it does change, and giving them a specific local-drive location to save it to.

  4. #4
    Silver Lounger Charles Kenyon's Avatar
    Join Date
    Jan 2001
    Location
    Sun Prairie, Wisconsin, Wisconsin, USA
    Posts
    2,049
    Thanks
    124
    Thanked 119 Times in 116 Posts
    If you can rely on them to do this, it would be fine. Otherwise you could put it in a login script so that it will always be where you expect it to be. vba can pick up the filepaths for the user templates folder, the workgroup templates folder and the startup folder from the user settings.
    Charles Kyle Kenyon
    Madison, Wisconsin

  5. #5
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    I usually try to avoid having a template rely on an external file unless there is a compelling reason to keep it external.

    Can you include the text file inside the template that calls it?
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  6. #6
    Star Lounger
    Join Date
    Aug 2001
    Location
    Hampshire, England
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, it's because of the fact that it does occasionally get updated that I originally thought it would be easier to call an external file. Then I could just adjust a couple of lines in the text file whenever I needed to (plus any successors to me would be able to as well, without them needing to know Word VBA), and my colleagues wouldn't have to reinstall their template, but it would just use the updated lists next time they ran it.

  7. #7
    Star Lounger
    Join Date
    Aug 2001
    Location
    Hampshire, England
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    OK, how about this: the default "tools" filepath (for the sake of picking some identifiable local location) is typically on the C drive, so I could have a button on the form that users could press as and when needed to download a copy of the updated text file from the network drive to the DefaultFilePath(wdToolsPath) location, and then have the template always look at that local version instead.

  8. #8
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts
    That sounds like it would work (as long as everyone remembers to hit that button).

    Rather than being specific about the path, I would relate the path to where the template is stored for that user, so both files can stay together.

    strPath = ActiveDocument.AttachedTemplate.Path & Application.PathSeparator & "myfile.txt"
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  9. #9
    Star Lounger
    Join Date
    Aug 2001
    Location
    Hampshire, England
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah, that sounds like a sensible option. Thanks Andrew.

Posting Permissions

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