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 Dialog default path

Hi

I'd like to display the open file dialog, but I'd like to default to the path that the workbook is in. I tried setting application.DefaultFilePath, but that didn't seem to help. I even tried opening and closing another file (quickly) in this path thinking it might stick -- it didn't

Is there any way to do this

Arthlan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default GetOpenFilename Dialog default path

Try this

Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = ThisWorkbook.Path
ChDrive MyPath
ChDir MyPath

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
If FName < False Then
Set wb = Workbooks.Open(FName)
MsgBox "your code"
wb.Close
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


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


"Arthlan" wrote in message ...
Hi,

I'd like to display the open file dialog, but I'd like to default to the path that the workbook is in. I tried setting

application.DefaultFilePath, but that didn't seem to help. I even tried opening and closing another file (quickly) in this path
thinking it might stick -- it didn't.

Is there any way to do this?

Arthlan



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
path names in getopenfilename Paul Shepherd Excel Programming 6 January 28th 04 10:59 AM
GetOpenFilename w/default starting directory [email protected] Excel Programming 1 November 9th 03 04:55 PM
GetopenFilename default path Srinath Excel Programming 5 October 10th 03 04:47 PM
GetOpenFilename - Default Folder Andy Excel Programming 3 September 19th 03 04:20 PM
specifing default folder with GetOpenFilename Brian Excel Programming 3 September 8th 03 01:55 PM


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