Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am finding that GetOpenFilename does not work consistently with MultiSelect
set to True. The documentation on GetOpenFilename says that when MultiSelect is set to True, it will always return an array unless the cancel button is clicked, in which case it returns False. Nevertheless, half the time that multiple files are selected it returns a Variant/String containing only the first of the filenames that was selected. Dim oSelection, oFileName As Variant oSelection = Application.GetOpenFilename(MultiSelect:=True) If Not IsArray(oSelection) Then Exit Sub For Each oFileName In oSelection MsgBox oFileName Next If I step through the code watching the Locals window I can see that after the selection is made, GetOpenFilename intermittently returns oSelection as Variant/Variant( ), in which case the code works correctly. Sometimes, however, it returns oSelection as Variant/String, in which case the code fails at "For Each oFileName In oSelection" and the code returns error "Type mismatch." I am not able to replicate this problem and of the few mentions I found of this error on the internet, nobody seems to have found a solution or source of the error. Any help would be greatly appreciated. Thank you. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
GetOpenFilename MultiSelect failure | Excel Programming | |||
VBA prob-GetOpenFilename with multiselect=true returns string | Excel Programming | |||
GetOpenFilename returns a string rather than an array | Excel Programming | |||
GetOpenFilename returns a string rather than an array | Excel Programming | |||
Calling a C++ DLL which returns a String | Excel Programming |