Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
bw bw is offline
external usenet poster
 
Posts: 74
Default Set Default Directory

I sent this earlier, but without a subject, and the news group appears to require a subject,
so I'm sending it again....
--------------------------------------
I have the following two statements (among others, of course):

TheFileName = Application.GetOpenFilename("Text Files (*.txt), *.txt")

Workbooks.OpenText Filename:=TheFileName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray

I would like the default directory to begin looking in to be C:\

I have tried the following with no success:

TheFileName = Application.GetOpenFilename("Text Files (*.txt), C:\.txt")

Thanks,
Bernie


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Set Default Directory

I posted this:

Try this

I will save your default folder first to set it back at the end

Sub test()
Dim SaveDriveDir As String
Dim TheFileName As Variant
SaveDriveDir = CurDir
ChDrive "C"
ChDir "C:\"
TheFileName = Application.GetOpenFilename("Text Files (*.txt), C:\.txt")

MsgBox "your code"

ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"bw" wrote in message ...
I sent this earlier, but without a subject, and the news group appears to require a subject,
so I'm sending it again....
--------------------------------------
I have the following two statements (among others, of course):

TheFileName = Application.GetOpenFilename("Text Files (*.txt), *.txt")

Workbooks.OpenText Filename:=TheFileName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray

I would like the default directory to begin looking in to be C:\

I have tried the following with no success:

TheFileName = Application.GetOpenFilename("Text Files (*.txt), C:\.txt")

Thanks,
Bernie




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Set Default Directory

Hi Bernie

This should do the trick for you:

ChDrive "C"
ChDir "C:\"
TheFileName = Application.GetOpenFilename("Text Files (*.txt), *.txt")

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"bw" wrote in message
...
I sent this earlier, but without a subject, and the news group appears to

require a subject,
so I'm sending it again....
--------------------------------------
I have the following two statements (among others, of course):

TheFileName = Application.GetOpenFilename("Text Files (*.txt), *.txt")

Workbooks.OpenText Filename:=TheFileName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray

I would like the default directory to begin looking in to be C:\

I have tried the following with no success:

TheFileName = Application.GetOpenFilename("Text Files (*.txt),

C:\.txt")

Thanks,
Bernie




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Set Default Directory

I didn't see your other post...I wonder why?

The Subject is NONE

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"bw" wrote in message ...
Thanks, Ron.

That did it for me.

I didn't see your other post...I wonder why?

Anyway, thanks for your help.
Bernie


On Wed, 30 Jul 2003 18:46:52 +0200, "Ron de Bruin"
wrote:
I posted this:

Try this

I will save your default folder first to set it back at the end

Sub test()
Dim SaveDriveDir As String
Dim TheFileName As Variant
SaveDriveDir = CurDir
ChDrive "C"
ChDir "C:\"
TheFileName = Application.GetOpenFilename("Text Files (*.txt), C:\.txt")

MsgBox "your code"

ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"bw" wrote in message news:1104_1059581509

@news.cableone.net...
I sent this earlier, but without a subject, and the news group appears to require a

subject,
so I'm sending it again....
--------------------------------------
I have the following two statements (among others, of course):

TheFileName = Application.GetOpenFilename("Text Files (*.txt), *.txt")

Workbooks.OpenText Filename:=TheFileName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray

I would like the default directory to begin looking in to be C:\

I have tried the following with no success:

TheFileName = Application.GetOpenFilename("Text Files (*.txt), C:\.txt")

Thanks,
Bernie









  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 576
Default Set Default Directory

bw,

Know what you mean. For some reason I'm not seeing all the posts either.
But using Find is a big help. You can even have it search by sender.

steve

"bw" wrote in message
...
Thanks, Ron.

That did it for me.

I didn't see your other post...I wonder why?

Anyway, thanks for your help.
Bernie


On Wed, 30 Jul 2003 18:46:52 +0200, "Ron de Bruin"


wrote:
I posted this:

Try this

I will save your default folder first to set it back at the end

Sub test()
Dim SaveDriveDir As String
Dim TheFileName As Variant
SaveDriveDir = CurDir
ChDrive "C"
ChDir "C:\"
TheFileName = Application.GetOpenFilename("Text Files (*.txt),

C:\.txt")

MsgBox "your code"

ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"bw" wrote in message news:1104_1059581509

@news.cableone.net...
I sent this earlier, but without a subject, and the news group appears

to require a
subject,
so I'm sending it again....
--------------------------------------
I have the following two statements (among others, of course):

TheFileName = Application.GetOpenFilename("Text Files (*.txt),

*.txt")

Workbooks.OpenText Filename:=TheFileName, Origin:=xlWindows, _
StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=myArray

I would like the default directory to begin looking in to be C:\

I have tried the following with no success:

TheFileName = Application.GetOpenFilename("Text Files (*.txt),

C:\.txt")

Thanks,
Bernie









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 directory to list default edbrog Excel Discussion (Misc queries) 2 January 31st 09 06:19 PM
set default directory for saving files Vibeke Excel Discussion (Misc queries) 5 August 23rd 07 12:52 PM
MSOffice default directory Max Setting up and Configuration of Excel 0 June 3rd 06 08:39 PM
Open to default directory in Excel Odawg Excel Discussion (Misc queries) 7 October 14th 05 05:23 AM
where is the default directory of excel macros ? excel macros Excel Discussion (Misc queries) 2 January 21st 05 07:16 PM


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

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"