Consulting

Results 1 to 5 of 5

Thread: modify Users Template locations

  1. #1
    VBAX Regular
    Joined
    Aug 2017
    Posts
    10
    Location

    modify Users Template locations

    Hi guys, I am a new user to word VBA, and This is my first post
    I use 2 Normal template files in the Word program
    - The first in this path: C:\Users\mohamed.rq\AppData\Roaming\Microsoft\Templates\
    - The second in this path: C:\Users\mohamed.rq\AppData\Roaming\Microsoft\Templates\New
    After the User Files Locations dialog box opens, how do I switch to the other path.
    Please help, Do it for me Please
    this is my code:
    Sub FileLocations()
    Dialogs(wdDialogToolsOptionsFileLocations).Display
    ' What am I doing then
    ' What am I doing then
    ' What am I doing then
    
    
    
    
    End Sub

  2. #2
    Microsoft Word MVP 2003-2009 VBAX Guru gmaxey's Avatar
    Joined
    Sep 2005
    Posts
    3,334
    Location
    Ignoring the question why would you want two Normal templates which seems abnormal,

    Sub ScratchMacro()
    'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 10/1/2017
     MsgBox GetUserTemplatePath
      Options.DefaultFilePath(Path:=wdUserTemplatesPath) = _
        "D:\My Documents\Word\Templates\Template Add-Ins\"
     MsgBox GetUserTemplatePath
      Options.DefaultFilePath(Path:=wdUserTemplatesPath) = _
        "D:\My Documents\Word\Templates\"
     MsgBox GetUserTemplatePath
    lbl_Exit:
      Exit Sub
    End Sub
    Function GetUserTemplatePath() As String
    Dim fDlg As Dialog
    Set fDlg = Dialogs(wdDialogToolsOptionsFileLocations)
    With fDlg
      .Path = "USER-DOT-PATH"
      .Update
      GetUserTemplatePath = .Setting
    End With
    End Function
    Greg

    Visit my website: http://gregmaxey.com

  3. #3
    Thanks, Greg for that info.

    I was not specifically looking for it; just happened to be reading the post and thought "This is what I might just want in the future". So have made a note of your code.

  4. #4
    VBAX Regular
    Joined
    Aug 2017
    Posts
    10
    Location
    Thank you very much, and please accept my apology.

  5. #5
    I am not sure why an apology was necessary, and I am not sure whether Greg's code will work without restarting Word to load an alternative normal template from the revised location. Frankly it is better not to mess with the normal template and use document templates to create your documents. Recent versions of Word don't exactly help with that, so I produced an add-in which allows templates to be used readily from a variety of user customisable locations - https://www.gmayor.com/select_document_template.htm and a companion add-in which allows you to easily load (and unload) add-in templates also from a variety of locations https://www.gmayor.com/load_word_addins.htm
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Tags for this Thread

Posting Permissions

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