+ Reply to Thread
Results 1 to 3 of 3

Append A Prefix String to Current Filename and Overwrite

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    65

    Append A Prefix String to Current Filename and Overwrite

    Hi,

    I am trying to add a Prefix string (with if condition) to the current filename and overwrite at the same location as the current file. A certain Prefix is appended to the current filename if the filename contains a partciular string such as 0915 or 1215, etc, then the file name is overwritten and saved and then moved to next file in the directory.

    However, I am not getting any result and its not working, may be its having trouble with Prefix declaration, but I can't figure it out as per my very limited excel vba knowledge. How can I make it work? For which reason it isn't working, this code? The vba code is pasted below:

    Please Login or Register  to view this content.
    Thanks for your help.

    Sanjeev.
    Last edited by sanjeevpandey; 02-14-2013 at 11:12 AM.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: Append A Prefix String to Current Filename and Overwrite

    Hi Sanjeev,

    There is no need to open the Excel workbook in order to perform a rename operation.

    Try the code below

    Please Login or Register  to view this content.
    If you like my contribution click the star icon!

  3. #3
    Registered User
    Join Date
    11-27-2012
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    65

    Re: Append A Prefix String to Current Filename and Overwrite

    Thanks OllieB, it worked swiftly, i wasted my time in calling the open file function!

    Have a nice day!

+ 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