File Locations Tab


File locations

alt text
Application.Options.DefaultFilePath(wdDefaultFilePath.wdDocumentsPath) = "" 
Application.Options.DefaultFilePath(wdDefaultFilePath.wdPicturesPath) = ""
Application.Options.DefaultFilePath(wdDefaultFilePath.wdUserTemplatesPath) = ""
Application.Options.DefaultFilePath(wdDefaultFilePath.wdWorkgroupTemplatesPath) = ""
Application.Options.DefaultFilePath(wdDefaultFilePath.wdAutoRecoverPath) = ""
Application.Options.DefaultFilePath(wdDefaultFilePath.wdToolsPath) = ""
Application.Options.DefaultFilePath(wdDefaultFilePath.wdStartUpPath) = ""

Setting this to the empty string will clear the entry.


How to retrieve Word's default Documents path or Pictures path setting



It is also possible to obtain the following directories as well
This is the directory of the start up path

Application.StartupPath = "C:\Documents and Settings\"User name"\Application Data\Microsoft\Word\Startup" 

This is the directory of the path where Excel.exe is stored

Application.Path = "C:\Program Files\Microsoft Office\OFFICE11\ 

It is also possible to obtain the path separator character - only useful for compatibility with Macintosh.

Application.PathSeparator = "\" 


You cannot use to get the default document path, because this returns the current FileOpen path, not the default documents path!!

myDocPath = Options.DefaultFilePath (wdDocumentsPath) 

Instead, use:

Dim myDocPath As String 
myDocPath = Dialogs(wdDialogToolsOptionsFileLocations).Setting

'Add a "\" at the end of the path, unless the setting is already followed by a "\" -
'which it will be if the setting is set to a root folder
If Not Right$(myDocPath, 1) = "\" Then
    myDocPath = myDocPath + "\"
End If

MsgBox myDocPath

Similarly, you cannot use because if the user has inserted a picture from a different folder, the Default File Path returns that folder rather than the actual setting from the dialog box.

myPicPath = Options.DefaultFilePath(wdPicturesPath) 

Instead, use:

With Dialogs(wdDialogToolsOptionsFileLocations) 
    .Path = "PICTURE-PATH"
    .Update
    myPicPath = .Setting

    If Not Right$(myPicPath, 1) = "\" Then
        myPicPath = myPicPath + "\"
    End If

    MsgBox myPicPath
End With


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext