Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Initial Folder of the FileDialog(msoFileDialogSaveAs) Object

Status
Not open for further replies.

tomatdeepwater

Programmer
Aug 18, 2005
11
US
I am doing some VBA programming in MS-Word for the first time.

I followed someone's example on how to call the MS-Word FileDialog "SaveAs" object.

Here is my code:

Code:
Dim dlgSaveAs As FileDialog

     CurDir (str_Desired_FilePath)
     
     Set dlgSaveAs = _
          Application.FileDialog( _
               FileDialogType:=msoFileDialogSaveAs)

     With dlgSaveAs
          .AllowMultiSelect = False
          .InitialView = msoFileDialogViewDetails
          .Title = "Where would you like to SAVE this FILE?"
          .InitialFileName = Initial_File_Save_Name
          .ButtonName = "SAVE"
          .Show
          
     End With ' dlgSaveAs

PROBLEM:

I need to also control the "folder" it initially opens up in. This code doesn't do that ...

Any ideas? [neutral]

 
Hi tomatdeepwater,

You don't show what your variables are set to but what I suspect you want is something like ...
Code:
.InitialFileName = str_Desired_FilePath & "\" & Initial_File_Save_Name

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
 
Thanks Tony,

You are right ... I didn't show the full filepath, but what you didn't see was that I did set the one variable
"Initial_File_Save_Name" to the full path (eg. C:\sss\xyz.doc). It gave me the correct filename but not the correct folder.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top