View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default GetOpenFileName - no array?

A very weird problem...

I've got a few fairly busy workbooks, lots of sheets, lots of code. I added
the following code:

sub temp
dim x as variant
x=application.getopenfilename(,,,,true)
stop
end sub

When I go into immediate mode, x has a single value, one of the files
selected. If I try to look at x(1) I get an error as x does not seem to be
an array.

I spent over an hour trying the following:
- got rid of all of the code, except for my temp sub (still failed)
- got rid of all names in the workbook (still failed)
- got rid of all but one sheet (aha!)
- etc.

Eventually I found that if I deleted one sheet in particular, the code
returned an array. Then I re-loaded, left the sheet in, but deleted all rows
and columns. It worked. I then moved, just moved, another sheet -- it
failed. I moved that other sheet around, and eventually it succeeded and
returned an array.

Can anyone give me any clues as to what's going on?
I'm running Excel 2003(11.8134.8132) SP2