+ Reply to Thread
Results 1 to 3 of 3

Using VB to renam files

  1. #1
    Peter
    Guest

    Using VB to renam files

    Hi all

    I have used some from the help screen of excel to be able
    to find and parse file names in pre-defined folders. What
    I would like to know is:

    if I find a filename called, say, 01 File 1.XLS and I want
    to rename it as just File 1.XLS, how can I do that.

    The files are listed using a For : Next loop using

    ..FilesFound(i) and I have tried to use the code

    ..FilesFound(i).Filename = fn3 where fn3 is the new name I
    want to give the file on disk but that just generates an
    error that I can't find a response for.

    Any help gratefully received. Thanks

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Peter,

    Use the Name As statement

    NAME OldFileName AS NewFileName

    Best,
    Leith Ross

  3. #3
    Bob Phillips
    Guest

    Re: Using VB to renam files

    Hi Peter,

    Try

    Name .FilesFound(i).Filename As fn3

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Peter" <anonymous@discussions.microsoft.com> wrote in message
    news:05be01c51736$11327740$a401280a@phx.gbl...
    > Hi all
    >
    > I have used some from the help screen of excel to be able
    > to find and parse file names in pre-defined folders. What
    > I would like to know is:
    >
    > if I find a filename called, say, 01 File 1.XLS and I want
    > to rename it as just File 1.XLS, how can I do that.
    >
    > The files are listed using a For : Next loop using
    >
    > .FilesFound(i) and I have tried to use the code
    >
    > .FilesFound(i).Filename = fn3 where fn3 is the new name I
    > want to give the file on disk but that just generates an
    > error that I can't find a response for.
    >
    > Any help gratefully received. Thanks




+ 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