none
Modifying WORD 2007 User Templates Path with VBS RRS feed

  • Question

  • Hi,

    I'm trying to find a way to Modifying WORD 2010 User Templates Path with VBS

    the User Templates located in : Word Options -> Advanced -> File Locations -> User Templates

    i tried to use the "wdUserTemplatesPath" in VB script - didnt work

    Need your help

    Tnx

    Monday, January 31, 2011 5:35 AM

Answers

  • Application.Options.DefaultFilePath([WdDEfaultFilePath Enum or Long equivalent]) = "the path string"

    But if you're working in a corporate environment this should be set by the IT department and not in your code. And it's possible, in such an environment, that access to that part of the Registry will be locked out (to prevent exactly what you're trying to do).


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bessie Zhao Monday, February 7, 2011 7:29 AM
    • Marked as answer by Bessie Zhao Tuesday, February 8, 2011 9:28 AM
    Monday, January 31, 2011 7:55 AM
    Moderator

All replies

  • Hello Avi2222,

    Thanks for posting. Actually, I am not very good at VB script. However, I have done a test by VBA code. When I run this VBA code in Word 2010, it works fine. Code like this,

    Sub test5()
        Dim strPath As String
        strPath = Options.DefaultFilePath(wdUserTemplatesPath)
        MsgBox strPath
        Options.DefaultFilePath(Path:=wdUserTemplatesPath) = "C:\Users\[user name]\AppData\"
    End Sub

    Sub test6()
        Options.DefaultFilePath(Path:=wdUserTemplatesPath) = _
            "C:\Users\[user name]\AppData\Roaming\Microsoft\Templates"
    End Sub

    Please check it and see if this could help you. Also here are some articles about wdUserTemplatesPath. Hope they could help you more or less.

    Problems with wdUserTemplatesPath when converting macro from WordXP to Word2010:
    http://social.answers.microsoft.com/Forums/en-US/officeprog/thread/ef6fb83f-e208-4c41-b5c6-e182cd620a23.

    How Can I Change File Locations for Microsoft Word?
    http://blogs.technet.com/b/heyscriptingguy/archive/2005/08/04/how-can-i-change-file-locations-for-microsoft-word.aspx.

    If this post does not help you, just feel free to follow up. Have a nice day.


    Bessie Zhao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 31, 2011 7:54 AM
  • Application.Options.DefaultFilePath([WdDEfaultFilePath Enum or Long equivalent]) = "the path string"

    But if you're working in a corporate environment this should be set by the IT department and not in your code. And it's possible, in such an environment, that access to that part of the Registry will be locked out (to prevent exactly what you're trying to do).


    Cindy Meister, VSTO/Word MVP
    • Proposed as answer by Bessie Zhao Monday, February 7, 2011 7:29 AM
    • Marked as answer by Bessie Zhao Tuesday, February 8, 2011 9:28 AM
    Monday, January 31, 2011 7:55 AM
    Moderator
  • Hi Avi2222,

    Have you resolved you issue yet? Do the suggestions work for you or not?

    If you still show any concern on this post, feel free to follow up.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 2, 2011 10:07 AM