LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default GetOpenFilename With MultiSelect Intermittently Returns String

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
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 MultiSelect failure Greg Wilson Excel Programming 12 January 2nd 06 12:16 AM
VBA prob-GetOpenFilename with multiselect=true returns string felze84 Excel Programming 1 October 18th 04 09:33 PM
GetOpenFilename returns a string rather than an array Dan Frederick Excel Programming 0 April 20th 04 08:38 PM
GetOpenFilename returns a string rather than an array Claritech Excel Programming 0 April 20th 04 06:08 PM
Calling a C++ DLL which returns a String Vorreiter Johann \(IFDA\) Excel Programming 2 January 13th 04 06:59 AM


All times are GMT +1. The time now is 09:02 PM.

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"