![]() |
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? |
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? |
All times are GMT +1. The time now is 05:53 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com