![]() |
Excel VBA. Setting the default path for GetOpenFileName
Excel VBA.
Setting 'Application.DefaultFilePath' before calling 'Application.GetOpenFileName' does not set the opening (default) directory. Anyone know how to do it? |
Excel VBA. Setting the default path for GetOpenFileName
Use the following:
ChDrive "C" ChDir "C:\Temp" If you want to be nice to the user and change it back to what it was: Dim sCurDir As String Dim sOpenFileName As String sCurDir = CurDir ChDrive "C" ChDir "C:\Temp" sOpenFileName = Application.GetOpenFileName ChDrive sCurDir ChDir sCurDir - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ to change the drive and directory to what you want. "Balmain Bushwalker" <Balmain wrote in message ... Excel VBA. Setting 'Application.DefaultFilePath' before calling 'Application.GetOpenFileName' does not set the opening (default) directory. Anyone know how to do it? |
Excel VBA. Setting the default path for GetOpenFileName
Thanx Jon - I will try your sugestion.
"Jon Peltier" wrote: Use the following: ChDrive "C" ChDir "C:\Temp" If you want to be nice to the user and change it back to what it was: Dim sCurDir As String Dim sOpenFileName As String sCurDir = CurDir ChDrive "C" ChDir "C:\Temp" sOpenFileName = Application.GetOpenFileName ChDrive sCurDir ChDir sCurDir - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ to change the drive and directory to what you want. "Balmain Bushwalker" <Balmain wrote in message ... Excel VBA. Setting 'Application.DefaultFilePath' before calling 'Application.GetOpenFileName' does not set the opening (default) directory. Anyone know how to do it? |
All times are GMT +1. The time now is 05:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com