Solved

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

Posted on 2008-11-02
3
2,155 Views
Last Modified: 2012-08-13
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
Comment
Question by:roseward
  • 2
3 Comments
 

Author Comment

by:roseward
ID: 22861326
strClientsPath is currently K:\DMS\Documents\1_ROSE-WARD_G\1_22_08_2007\
I have tried it with & without the trailing backslash ....
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 22862120
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
 

Author Comment

by:roseward
ID: 22862421
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Office 365 is currently available in five editions. Three of them are for business use: Office 365 Business Essentials, Office 365 Business, and Office 365 Business Premium. Two of them are for home/personal use: Office 365 Home and Office 365 Perso…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question