Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
plh plh is offline
external usenet poster
 
Posts: 48
Default Chdir does not seem to change the current directory -- ??

Hello X-L Gurus!
I am using the GetOpenFileName method and I would like to have it open into a
predetermined folder. I wrote the code as follows:

ChDir "G:\MULTUS\PROVEOUT\"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")

It opens in the "My Documents" folder instead. Any ideas?

Thank You,
-plh

PS:
I also tried
ChDir "G:\MULTUS\PROVEOUT"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")
That is without the final "\" in the ChDir statement and got the same result.


--
Where are we going and why am I in this HAND BASKET??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Chdir does not seem to change the current directory -- ??

Try this instead:

Private Declare Function SetCurrentDirectoryA _
Lib "kernel32" (ByVal lpPathName As String) As
Long

Function ChDirAPI(strFolder As String) As Long
'will return 1 on success and 0 on failure
'will work with a UNC path as well
'-----------------------------------------
ChDirAPI = SetCurrentDirectoryA(strFolder)
End Function

Then just replace your ChDir with ChDirAPI


RBS



"plh" wrote in message
...
Hello X-L Gurus!
I am using the GetOpenFileName method and I would like to have it open
into a
predetermined folder. I wrote the code as follows:

ChDir "G:\MULTUS\PROVEOUT\"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file
you
want to process.")

It opens in the "My Documents" folder instead. Any ideas?

Thank You,
-plh

PS:
I also tried
ChDir "G:\MULTUS\PROVEOUT"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file
you
want to process.")
That is without the final "\" in the ChDir statement and got the same
result.


--
Where are we going and why am I in this HAND BASKET??


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default Chdir does not seem to change the current directory -- ??

You need to be on drive G: before it will let you change directory

ChDrive "G"
ChDir "G:\MULTUS\PROVEOUT\"

"plh" wrote:

Hello X-L Gurus!
I am using the GetOpenFileName method and I would like to have it open into a
predetermined folder. I wrote the code as follows:

ChDir "G:\MULTUS\PROVEOUT\"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")

It opens in the "My Documents" folder instead. Any ideas?

Thank You,
-plh

PS:
I also tried
ChDir "G:\MULTUS\PROVEOUT"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")
That is without the final "\" in the ChDir statement and got the same result.


--
Where are we going and why am I in this HAND BASKET??

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Chdir does not seem to change the current directory -- ??

Or have a look at the help file on the dialogs object
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Chdir does not seem to change the current directory -- ??

Make sure you change the drive, too:

Dim myFolder as string
myFolder = "G:\MULTUS\PROVEOUT\"
ChDrive myFolder
ChDir myfolder





plh wrote:

Hello X-L Gurus!
I am using the GetOpenFileName method and I would like to have it open into a
predetermined folder. I wrote the code as follows:

ChDir "G:\MULTUS\PROVEOUT\"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")

It opens in the "My Documents" folder instead. Any ideas?

Thank You,
-plh

PS:
I also tried
ChDir "G:\MULTUS\PROVEOUT"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")
That is without the final "\" in the ChDir statement and got the same result.

--
Where are we going and why am I in this HAND BASKET??


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.programming
plh plh is offline
external usenet poster
 
Posts: 48
Default Chdir does not seem to change the current directory -- ??

Worked Swimmingly, Thank You!
-plh
In article , Dave Peterson says...

Make sure you change the drive, too:

Dim myFolder as string
myFolder = "G:\MULTUS\PROVEOUT\"
ChDrive myFolder
ChDir myfolder





plh wrote:

Hello X-L Gurus!
I am using the GetOpenFileName method and I would like to have it open into a
predetermined folder. I wrote the code as follows:

ChDir "G:\MULTUS\PROVEOUT\"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")

It opens in the "My Documents" folder instead. Any ideas?

Thank You,
-plh

PS:
I also tried
ChDir "G:\MULTUS\PROVEOUT"
strCurrentFile = Application.GetOpenFilename(, , "Please choose the file you
want to process.")
That is without the final "\" in the ChDir statement and got the same result.

--
Where are we going and why am I in this HAND BASKET??




--
Where are we going and why am I in this HAND BASKET??
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
Change current directory to the directory that the workbook loads from! alondon Excel Programming 5 April 17th 07 06:05 AM
current directory Ross[_2_] Excel Discussion (Misc queries) 1 April 2nd 07 10:00 PM
Current Directory Mallasch Excel Discussion (Misc queries) 4 September 15th 06 03:05 AM
get current directory Souris Excel Programming 1 September 27th 05 11:53 AM
changing current directory to that of the current open file unnameable Excel Programming 2 May 19th 04 11:14 AM


All times are GMT +1. The time now is 04:31 PM.

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

About Us

"It's about Microsoft Excel"