G
Greg Wilson
I need to use Application.GetOpenFilename with MultiSelect set to True to
obtain a list of files as an array. The project is rather large and complex.
The appended code consistantly failes to return an array. It is just simple
test code.
When it is run in this project it returns "String" when it should return
"Variant". Other projects return "Variant" with the exact same code. MsgBox
UBound(arr) returns an error ("Type mismatch") but in other projects the
exact same code (copied and pasted) returns an integer.
I have commented out all Workbook_Open code plus all other code in standard
modules (UF code excepted) including all local and public var declarations;
then closed and reopend the project, in an attempt to source the problem.
This has no effect. I ensure that I select the exact same files in exactly
the same way. I have used Rob Bovey's Code Cleaner to no effect. I have
exported the code module to a floppy and imported to another project on
another computer and it works (in the context of the entire module). I have
rebooted to no effect.
Hoping someone has an insight or can provide a list of the usual suspects.
It's an important project and I need this to work. My brain is fogged from
late nights working on this. For what it's worth, the test code follows. Very
appreciative of your time and effort.
Greg
Sub Test()
Dim arr As Variant
arr = Application.GetOpenFilename("Excel files (*.xls), *.xls",
MultiSelect:=True)
MsgBox TypeName(arr)
End Sub
obtain a list of files as an array. The project is rather large and complex.
The appended code consistantly failes to return an array. It is just simple
test code.
When it is run in this project it returns "String" when it should return
"Variant". Other projects return "Variant" with the exact same code. MsgBox
UBound(arr) returns an error ("Type mismatch") but in other projects the
exact same code (copied and pasted) returns an integer.
I have commented out all Workbook_Open code plus all other code in standard
modules (UF code excepted) including all local and public var declarations;
then closed and reopend the project, in an attempt to source the problem.
This has no effect. I ensure that I select the exact same files in exactly
the same way. I have used Rob Bovey's Code Cleaner to no effect. I have
exported the code module to a floppy and imported to another project on
another computer and it works (in the context of the entire module). I have
rebooted to no effect.
Hoping someone has an insight or can provide a list of the usual suspects.
It's an important project and I need this to work. My brain is fogged from
late nights working on this. For what it's worth, the test code follows. Very
appreciative of your time and effort.
Greg
Sub Test()
Dim arr As Variant
arr = Application.GetOpenFilename("Excel files (*.xls), *.xls",
MultiSelect:=True)
MsgBox TypeName(arr)
End Sub