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


LS,

from Excel with VBA using a UserForm I can display the files in a
special directory, using:

With Application.FileDialog(msoFileDialogOpen)
..InitialFileName = strPath & "\*"
..AllowMultiSelect = False
..Show
End With

How do I manage that from that FileDiaolog a file (.xls, .doc or .txt)
can be opened?

Doubleclick on the file gives no result.


--
H.A. de Wilde
------------------------------------------------------------------------
H.A. de Wilde's Profile: http://www.excelforum.com/member.php...o&userid=30679
View this thread: http://www.excelforum.com/showthread...hreadid=548160

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Application.FileDialog(msoFileDialogOpen)

This example use GetOpenFilename that can do the same and it is working in 97 and up

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


For multiselect do it like this

Sub testing()
Dim FName As Variant
Dim N As Long
FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls", _
MultiSelect:=True)

If IsArray(FName) Then
For N = LBound(FName) To UBound(FName)
Workbooks.Open (FName(N))
Next
End If
End Sub


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



"H.A. de Wilde" wrote in message
news:H.A.de.Wilde.28ufsm_1149367203.8099@excelforu m-nospam.com...

LS,

from Excel with VBA using a UserForm I can display the files in a
special directory, using:

With Application.FileDialog(msoFileDialogOpen)
InitialFileName = strPath & "\*"
AllowMultiSelect = False
Show
End With

How do I manage that from that FileDiaolog a file (.xls, .doc or .txt)
can be opened?

Doubleclick on the file gives no result.


--
H.A. de Wilde
------------------------------------------------------------------------
H.A. de Wilde's Profile: http://www.excelforum.com/member.php...o&userid=30679
View this thread: http://www.excelforum.com/showthread...hreadid=548160



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
Using Application.FileDialog(msoFileDialogFolderPicker) Ayo Excel Discussion (Misc queries) 1 March 12th 08 01:01 PM
FileDialog(msoFileDialogOpen) Mitch Excel Programming 5 April 14th 06 08:16 PM
filedialog Norm Excel Worksheet Functions 0 July 29th 05 10:17 PM
Alternative to Application.FileDialog (please)? Rob Bovey Excel Programming 0 September 9th 04 11:20 AM
FileDialog Help Maynard Excel Programming 0 August 4th 04 01:43 PM


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