View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Default File Path

reply form soggy southeast us
I don't know if it will help your situation but you
can goto tooloptions click general tab
third box from the bottom you can set the default folder.
good look.

-----Original Message-----
Hello everyone from the soggy Southeast US.

I have a workbook which contains only a menu form and
supporting code. I use that menu to open a new workbook
based on a template as well as to open existing workbooks
created previously using the same template. When a new
workbook is opened I provide a name and the file is
supposed to be saved to a fixed directory that I provide.
The directory is one of my own creation, exists and is
accessible. In fact the code I am currently having
problems with worked previously. When the file is saved,
it is saved to the "C:\Program Files\Microsoft Office"
directory but it is supposed to be saved to
the "C:\Datafiles" directory.When the workbook is opened
the following code is executed:

Application.DefaultFilePath

= "C:\TRUSpreadSheet\DataFiles"

To be sure the path was being saved correctly I put a
temporary field on my form and run the following code
during execution of the code to populate the field with
the default file path:

TextBox1 = Application.DefaultFilePath

Then the following code executes:

MyFName = fld_FileName & ".xls"

Set MyWkb1 = Workbooks.Open
(fileName:="C:\TRUSpreadSheet\TRUWt%Conversion.xl t")
MyWkb1.Activate

where fld_FileName is a string taken from the user on the
data input form.

Everything works properly except the location where the
field resides and when I attempt to open an existing
workbook using the getOpenFilename method it opens
the "File Open" dialog box to the "C:\Program
Files\Microsoft Office" directory.Again, this is
functionally and logically after issuing the "application.

Help! What next?

Kevin
.