G
Guest
I have the code below that will allow multiple selections of files from a
dialog box. When I don't select anything and click cancel it gives me an
error. I tried to disable warnings and that didn't work. I also checked if
v was null or empty and that got rid of the error when I didn't select
anything. But when I selected files it would give me an error.
I'm assuming that it has to do with v being a variant. I'm not sure how to
deal with this and catch the errors so they don't show up.
Dim v as Variant
v = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls),*.xls",
FilterIndex:=1, Title:="Select File(s)", MultiSelect:=True)
If Not IsEmpty(rng) Then rng = rng.Offset(1, 0)
rng.Resize(UBound(v) - LBound(v) + 1, 1).Value = Application.Transpose(v)
dialog box. When I don't select anything and click cancel it gives me an
error. I tried to disable warnings and that didn't work. I also checked if
v was null or empty and that got rid of the error when I didn't select
anything. But when I selected files it would give me an error.
I'm assuming that it has to do with v being a variant. I'm not sure how to
deal with this and catch the errors so they don't show up.
Dim v as Variant
v = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls),*.xls",
FilterIndex:=1, Title:="Select File(s)", MultiSelect:=True)
If Not IsEmpty(rng) Then rng = rng.Offset(1, 0)
rng.Resize(UBound(v) - LBound(v) + 1, 1).Value = Application.Transpose(v)