![]() |
GetOpenFilename returns a string rather than an array
I was having the exact same problem and was able to track it down t Conditional Formatting with a function in the "Formula Is" field. Don't ask me why, but if you try to do a Multi-select and one of th cells in any open workbook has Conditional Formatting using th "Formula Is" option and then a function in the formula cell, it fail to return the array of filenames. Clearly this is a bug and it may als be caused by something else equally as obscure. Try it and let me know what you come up with. The next trick is to try to find all of the conditional formatting i my worksheet! Dan Frederick Claritech Solutions Geoff Kelly wrote:[color=blue] *This is weird. I copied your code into a macro and saw simila behaviour - with the singlefileselect lines commented out, I got the user cancel message. Re-inserting them let multiselect work fine. Now for the really weird part - it then continued to work fine after commenting them out again, even after rebooting my PC, eve re-creating the macro in another workbook! Following code works every time now (ie f is an array if one or mor files selected) Sub test1() Dim f As Variant f = Application.GetOpenFilename(MultiSelect:=True) If IsArray(f) Then MsgBox "count=" & Format(UBound(f)) & ", f(1)=" & f(1) Else MsgBox "not array, " & f End If End Sub Geoff "Lew" wrote in message om... -- More on this issue --- GetOpenFilename() appears to work on the PC if and only if you cal it with Multiselect set to "false" first. If I comment out the lines in the sniplet bleow to do the singlefileselect first, the multiselect quits working. This used to work right. Does anyone know what the problem is?? Lew --- sniplet -- Sub TestIt() Dim SingleFileSelect As String Dim MultiFileSelect As Variant Dim i As Integer SingleFileSelect Application.GetOpenFilename(MultiSelect:=False) MsgBox "No multi select " & SingleFileSelect MultiFileSelect = Application.GetOpenFilename(MultiSelect:=True) If IsArray(MultiFileSelect) Then For i = LBound(MultiFileSelect) To UBound(MultiFileSelect) MsgBox "Multi select " & MultiFileSelect(i) Next i Else MsgBox "User pressed cancel" End If End Sub - Claritec ----------------------------------------------------------------------- Posted via http://www.mcse.m ----------------------------------------------------------------------- View this thread: http://www.mcse.ms/message472480.htm |
All times are GMT +1. The time now is 06:17 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com