Results 1 to 2 of 2

Thread: Wildcards in pathname

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Posts
    7

    Unhappy Wildcards in pathname

    Is it possible to use wildcards in a pathname? The problem is, I have been asked to create an application using Access that copies files from one folder to another, using the FileSystemObject and then deletes the original files. I can do this no problem as long as the paths to the folders are known. Unfortunately, mine aren't unknown and need to build them up as follows:

    If I have a file called PL-50-12345-A.doc, it would be located in:
    N:\Products\50 Mechanical Component\50-123xx\50-12345 Plate Mtg Top Slide Proj\Dev (Mech).

    The destination folder would be:
    N:\Products\50 Mechanical Component\50-123xx\50-12345 Plate Mtg Top Slide Proj\Current

    I somehow need to build up this path using the '50-12345' part of the filename. Now I thought this would be possible but it seems that I can't use wildcards in pathnames.

    Forgive me if I am mistaken, this is my first attempt at VBA and I think I've been thrown in the deep end!

    Any help would be very much appreciated. Thanks.

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    The FileCopy function and/or FSO wont allow wildcards when copying files. It will want accurate filenames.

    You can build up the filename using LEFT, MID, INSTR, InStrRev etc. These allow you to to take a string (the full filename and path) and to extract out the bits you want into other strings (the new filename and path you are copying to).

Posting Permissions

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



Click Here to Expand Forum to Full Width