View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
LuisE LuisE is offline
external usenet poster
 
Posts: 133
Default Split ActiveCell.Value and delete element if.........

Rick, thanks for your time.

I'm using GetOpenFileName to place the name (and path) of the selected file
in the active cell. When a Word file is selected the extension returned is
..docx instead of .doc

e.g
C:\Users\luis\Documents\July 28.docx
I'm affraid the user would be tempted (as I was) to remove the "x"
considering it an error. Obviously if the "x" is removed, the Len(Dir()
validation won't work.

I was thinking of changing the color index of the X to 2 so that it will
become "not visible" at first sight.
How can it be done in this context? Any other ideas?

Thanks









"Rick Rothstein (MVP - VB)" wrote:

Is the Len(Dir(x(i))) 100% reliable? I don't want to delete something
that I should not.


Sorry, I forgot to address that in my comments. The only way your
statement...

CBool(Len(Dir(x(i)))) = False

can evaluate to True is if the length of Dir(x(i)) is zero; hence, there is
no need to cast the 0 to a Boolean just to see if it is False.


As for the text files showing extensions like ".docx" I was thinking of
making the ColorIndex of "x" 2, if there is not a better way to not
mislead
he user. How can I accomplish it?


To be quite honest, I didn't really follow what the problem was with the
..doc/.docx (all I did was modify your existing code), so I'm not sure how to
answer you on this. Perhaps if you post some additional details, it might
become clearer to me (unless, of course, someone jumps in and gives you an
answer first).


Rick