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


Hi,

Is there a way to select the folder path as opposed to the file path
using this method.

directory = Application.GetOpenFilename("Excel Files (*.xls), *.xls")

I want to use the save as window, similar to selecting the file path
with the above line. Things is I want the folder/directory path.

Any ideas would be greatly appreciated.

Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=472937

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

Hi

See the second example on this page
http://www.rondebruin.nl/windowsxpzip.htm

You can use the code from that macro


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


"Tomski" wrote in message
...

Hi,

Is there a way to select the folder path as opposed to the file path
using this method.

directory = Application.GetOpenFilename("Excel Files (*.xls), *.xls")

I want to use the save as window, similar to selecting the file path
with the above line. Things is I want the folder/directory path.

Any ideas would be greatly appreciated.

Cheers,

Tom


--
Tomski
------------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...o&userid=26824
View this thread: http://www.excelforum.com/showthread...hreadid=472937



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default GetOpenFileName

Tom,
This gives you the folder for the file selected in GetOpenFileName...
'-------------------------------
Sub FolderFromFilePath()
Dim strLocation As Variant
Dim N As Long

strLocation = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If strLocation = False Then Exit Sub
For N = Len(strLocation) To 1 Step -1
If Mid$(strLocation, N, 1) = "\" Then Exit For
Next

strLocation = Left$(strLocation, N - 1)
MsgBox strLocation
End Sub
'-------------------------
Jim Cone
San Francisco, USA

"Tomski"

wrote in message
...

Hi,
Is there a way to select the folder path as opposed to the file path
using this method.
directory = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
I want to use the save as window, similar to selecting the file path
with the above line. Things is I want the folder/directory path.
Any ideas would be greatly appreciated.
Cheers,
Tom

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default GetOpenFileName


Nice one guys, thanks for that.



--
Tomsk
-----------------------------------------------------------------------
Tomski's Profile: http://www.excelforum.com/member.php...fo&userid=2682
View this thread: http://www.excelforum.com/showthread.php?threadid=47293

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
GetOpenFileName with F*.txt DRK Excel Programming 6 June 7th 05 12:45 PM
GetOpenFilename Roman Excel Programming 5 February 8th 05 10:20 PM
GetOpenFileName Greg Bloom Excel Programming 2 February 9th 04 04:09 PM
GetOpenFilename Greg Bloom Excel Programming 0 February 9th 04 03:32 PM
GetOpenFilename Wolfgang Excel Programming 1 February 6th 04 07:37 PM


All times are GMT +1. The time now is 12:50 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"