Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 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?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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?




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set a default path when using Application.GetOpenFilename pkohler[_8_] Excel Programming 2 July 13th 04 10:12 PM
How do I set a default path when using Application.GetOpenFilename pkohler[_7_] Excel Programming 2 July 13th 04 07:17 PM
GetOpenFilename Dialog default path Arthlan Excel Programming 1 June 3rd 04 09:19 PM
GetopenFilename default path Srinath Excel Programming 5 October 10th 03 04:47 PM
Setting default directory prior to GetOpenFilename David R[_3_] Excel Programming 2 September 2nd 03 12:35 PM


All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"