+ Reply to Thread
Results 1 to 3 of 3

Opening files with only part of the name

Hybrid View

  1. #1
    Registered User
    Join Date
    11-25-2008
    Location
    USA
    Posts
    5

    Opening files with only part of the name

    Greetings,
    I am new to VBA and trying to write a program that will open a group of files whose name is in the format S1T1C1.vfc where the S1T1 part of the name will remain constant (S refers to subject number and T refers to trial number) but the "C1" (condition) will be different every time since we randomize our trials. I have a working loop that will open all the trials for a particular subject but only if I remove the last two letters of the file name in the folder.

    Is there a way to only look at the first part of the file name (which will be unique) and ignore the last two characters?

    Thanks for any help you can provide,
    Marcus

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    Are these Excel files or what other application?

    A loop using Dir() as Ger posted would be the route to do it. The opening depends on the answer above.
    http://www.ozgrid.com/forum/showthread.php?t=121254

  3. #3
    Registered User
    Join Date
    11-25-2008
    Location
    USA
    Posts
    5
    Thanks for the help that did it. These are not excel files but I just recorded a macro with the steps to bring them in to excel.
    cheers,
    marcus

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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