Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Changing Directory for GetOpenFileName

Hi Chaplain

MyPath = "C:\Data"
ChDrive MyPath
ChDir MyPath

This is not working if you want to use a network folder
ChDirNet is working for local and network folders

But your second example must work if you have used ChDrive and ChDir
Application.DefaultFilePath = "H:\Finance\Payroll ACH Files"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Chaplain Doug" wrote in message ...
Dear Ron:

Works like a charm. Thanks. Why did not my approach work?
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org


"Ron de Bruin" wrote:

Hi Chaplain

You must use ChDirNet, copy this at the top of your module

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

Sub ChDirNet(szPath As String)
Dim lReturn As Long
lReturn = SetCurrentDirectoryA(szPath)
If lReturn = 0 Then Err.Raise vbObjectError + 1, "Error setting path."
End Sub


Then use this in your macro

ChDirNet "\\ComputerName\YourFolder"




--
Regards Ron de Bruin
http://www.rondebruin.nl


"Chaplain Doug" wrote in message
...
Excel 2003. I am using

FName = Application.GetOpenFilename("Text Files (*.txt), *.txt", , "Select
ACH

to select a file to process. I want this dialog to open into a specific
folder. Right now it opens into my "My Documents" folder. I have tried:

Application.DefaultFilePath = "\\hqserver\shared\Finance\Payroll ACH Files"
and
Application.DefaultFilePath = "H:\Finance\Payroll ACH Files"

but neither seems to change the folder the GetOpenFilename looks in. How
may I accomplish what I am trying to accomplish? Thanks and God bless.
--
Dr. Doug Pruiett
Good News Jail & Prison Ministry
www.goodnewsjail.org






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
Directory "Locked" when selecting multiple files using GetOpenFilename esbey Excel Programming 1 March 4th 04 04:29 AM
How to assign directory for GetOpenFilename method Tim_M Excel Programming 1 December 10th 03 12:03 AM
specify an input directory with GetOpenFilename Valeria[_2_] Excel Programming 2 November 25th 03 05:32 PM
GetOpenFilename w/default starting directory [email protected] Excel Programming 1 November 9th 03 04:55 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 05:39 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"