Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jan 2003
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Relative vs. absolute path - different servers (Word 2000)

    Could someone please share with me the code I need to make a path name relative when the template files exist on two different servers. I don't want to have to duplicate the template program so that both sites can use it (find and replace path names)--I would like to program it only once and then install the program on each server. All templates are currently stored on two different servers (they are exactly the same templates--just duplicated in two locations).

    I would greatly appreciate any help I can get. Many thanks...Mary

    Sample of current code follows:

    Documents.Add Template:= _
    "CentusProcess R&DTemplatesxyz.dot", NewTemplate:= False
    ' "SMS1SSharedDataTemplatesxyz.dot", NewTemplate:= False

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Relative vs. absolute path - different servers

    Mary,

    If you have the option of putting the templates into a defined template directory - or put another way, if you have the option of defining the template folder, on whichever server, as a defined template directory for users on that server, then you can simply use one of the built-in default file path constants, rather than a specific path.

    For instance, following your example, if your "Templates" folder is defined as the Workgroup templates directory for the users on any given server, then the following code should work on any server:
    <pre>Documents.Add Template:=Options.DefaultFilePath(wdWorkgroupTempl atesPath) _
    & Application.PathSeparator & "xyz.dot", NewTemplate:=False</pre>

    Gary

  3. #3
    2 Star Lounger
    Join Date
    Jan 2003
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relative vs. absolute path - different servers

    Many thanks, Gary. I will check with our network administrator and see if he can set up the defined template directories for users on both servers. If so, I'll then try the code you sent and let you know how it goes. Very much appreciate your advice....Mary

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

    Re: Relative vs. absolute path - different servers

    <hr>& Application.PathSeparator &<hr>
    Up until now, working with VBA in Word and Excel, I use '& "" &' in that situation and that never causes any problems. So my question is, are there really different path separators in the various Office application? If not, why shouldn't I use "" (which is much shorter) instead of Application.PathSeparator?

  5. #5
    2 Star Lounger
    Join Date
    Jan 2003
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Relative vs. absolute path - different servers

    Hello, Gary...Just a quick note to thank you again. Our network administrator did as you suggested, and I modified my code as you suggested (code for 44 template options!), and it works beautifully. Many, many thanks!...Mary

  6. #6
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,809
    Thanks
    4
    Thanked 236 Times in 218 Posts

    Re: Relative vs. absolute path - different servers

    I use the application.pathseparator rather than the "" for no apparent reason other than I would expect that if the code was run on a Mac version of Office it would put in a ":" instead.

    I suspect that the pathseparator is more OS related than application related.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

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

    Re: Relative vs. absolute path - different servers

    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
  •