Solved

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

Posted on 2008-11-02
3
2,134 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
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 teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now