Help! File extensions

I do believe I'm losing my mind.

Please apply the following code to an object:



'Called when files are dropped onto object
Sub Object_OnDropFiles(files)
strExtension = Right(files,Len(files)-InStrRev(files,"."))
msgbox strExtension
msgbox Len(strExtension)
End Sub


Now, drag and drop an image file onto it.

The first msgbox should show the file extension. The second msgbox should show how many characters are in the extension.

EDIT:

Only one problem: The number of characters is 4 instead of 3.

2,602 views 8 replies
Reply #1 Top
  Nevermind. I created a solution.
Reply #2 Top
glad we could all help
Reply #3 Top
Heh.  
Reply #4 Top
crap. I didn't know the answer....


you guys rock
Reply #5 Top
Was the answer using the GetExtensionName Method?
Reply #6 Top
 Where were you when I was pulling my hair out over this?! GetExtensionName works better. Can't believe I didn't find this when I was googling about. Thanks, SirS.

Now, is there a GetMyHairBack Method or am I stuck sporting the Britney look?  
Reply #7 Top
Now, is there a GetMyHairBack Method or am I stuck sporting the Britney look?



Reply #8 Top
The only reason I knew it was from the Shortcut Parsing script. Plus I read up in the Windows Script Resource about it. I always find the best search terms are vbscript+FileSystemObject+find file extension