Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
File Open Dialogue Box to a Specified Location
I want the user to click on a button in a spreadsheet, select a workbook and
open it. In order to do this, I created a dialogue to get the file name and path. What I would like is for the dialogue box to open to a designated location. To do this I tried the following code: Dim FileName as string, Path as string Path="C:\New Documents" Application.SetDefaultPath=Path FileName = Application.GetOpenFileName("Excel Files (*.xls), *.xls") Workbooks.Open Filename:= FileName The problem is the dialogue always opens to "My Documents" and ignores the Set Default Path. On the Application.SaveAsFileName method, there is a setting called Initial Filename which allows me to set the initial path. Is there a way to set the path so that the Open File dialogue opens to a particualar location? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
File Open Dialogue Box to a Specified Location
Use ChDrive and ChDir to set the current path to what you want. Then
GetOpenFileName will open there. -- Jim "JR_06062005" wrote in message ... |I want the user to click on a button in a spreadsheet, select a workbook and | open it. In order to do this, I created a dialogue to get the file name and | path. What I would like is for the dialogue box to open to a designated | location. To do this I tried the following code: | | Dim FileName as string, Path as string | Path="C:\New Documents" | Application.SetDefaultPath=Path | FileName = Application.GetOpenFileName("Excel Files (*.xls), *.xls") | Workbooks.Open Filename:= FileName | | The problem is the dialogue always opens to "My Documents" and ignores the | Set Default Path. On the Application.SaveAsFileName method, there is a | setting called Initial Filename which allows me to set the initial path. Is | there a way to set the path so that the Open File dialogue opens to a | particualar location? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA to ask for file location and use to open DB | Excel Worksheet Functions | |||
Sort order in File Open dialogue box | Excel Discussion (Misc queries) | |||
In Excel, a dialogue box comes up and says "unable to open file". | Excel Discussion (Misc queries) | |||
Open file dialogue box | Excel Programming | |||
Opening Open File Dialogue box from Excel97 | Excel Programming |