Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2263
  • Last Modified:

Word 2007 VBA Application.FileDialog(FileDialogType:=msoFileDialogSaveAs)

Having the following code to set the default DOC-PATH

Options.DefaultFilePath(path:=wdDocumentsPath) = strClientsPath

and the following code to bring up a SaveAs dialog box

    Dim dlgSaveAs As FileDialog
    Set dlgSaveAs = Application.FileDialog(FileDialogType:=msoFileDialogSaveAs)
    dlgSaveAs.InitialFileName = strFileName
    dlgSaveAs.InitialView = msoFileDialogViewLargeIcons
    dlgSaveAs.Show
    dlgSaveAs.Execute

The problem is Word just ignores my path settings completely and saves to the Documents folder (Vista)

Anyone have any idea what i'm doing wrong ?

Regards

Glenn
0
roseward
Asked:
roseward
  • 2
1 Solution
 
rosewardAuthor Commented:
strClientsPath is currently K:\DMS\Documents\1_ROSE-WARD_G\1_22_08_2007\
I have tried it with & without the trailing backslash ....
0
 
GrahamSkanCommented:
The default path is the one that Word first uses in the session. Thereafter it remembers the last path used.

Concatenate the file name to the path and set the initial fiel name to the whole string.

dlgSaveAs.InitialFileName = strClientsPath & "\" & strFileName
0
 
rosewardAuthor Commented:
Duh !  

Thanks Graham, i sorta knew it had to be something simple but i'd been sat here too long and moved on to something else having given it up for a while.

Well done !
Glenn
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now