+ Reply to Thread
Results 1 to 6 of 6

getting files' extensions?

  1. #1
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96

    getting files' extensions?

    Hi all. After some excellent advice from shg, I've figured out that a user defined data type is exactly what I need to make my file cataloging project move forward. Now, I have a simpler question. How do I get the extension of a given file? I know that I can do a long, drawn out process of searching each file's name for the "." character, verifying that it's near the end of the string, counting its position, and clipping the characters before it. But, I assume there's some much simpler way to do it. Here's my code:

    Please Login or Register  to view this content.
    As you can see, I tried the GetExtensionName method, but it just didn't work. I get runtime error 438, "Object does not support this property or method." According to Help, I need a FileSystemObject before the method, and I need to have a path as the argument. I believe I've done both those things, but it appears I have not. Any suggestions?
    -Adam Hartman
    Mechanical Engineer

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    maybe

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96

    close but too general

    Quote Originally Posted by royUK
    maybe

    Please Login or Register  to view this content.
    Roy,

    That's what I would do in a simple case. However, some files have extensions that are 2 letters long and some have 4. I could make some logic to capture all those cases, but it seems like the GetExtensionName method should do what I need if only I knew how to use it correctly.

  4. #4
    Registered User
    Join Date
    03-24-2008
    Location
    Calabar, Nigeria
    MS-Off Ver
    2003, 2007
    Posts
    37

    Try This

    Please Login or Register  to view this content.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Maybe

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96
    Quote Originally Posted by royUK
    Maybe

    Please Login or Register  to view this content.
    That was it! Thanks a bunch.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1