+ Reply to Thread
Results 1 to 6 of 6

VBA to Rename if File Exists

  1. #1
    Registered User
    Join Date
    11-15-2011
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2003
    Posts
    13

    VBA to Rename if File Exists

    I am trying to rename if the file exists. My problem is that it pulls the name from a cell and I can't figure out how to incorporate the rename in my code.

    I have 2 macro's 1 for save as pdf and 1 for save workbook.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Last edited by mytouchsr; 05-29-2014 at 12:41 PM. Reason: Code Tags

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: VBA to Rename if File Exists

    NAME oldFullFilePath, newFullFilePath

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA to Rename if File Exists

    Hi,

    Your posts do not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    11-15-2011
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: VBA to Rename if File Exists

    Sorry, I fixed the post. Haven't been here in awhile and I forgot, thanks for the reminder.

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: VBA to Rename if File Exists

    Hi, mytouchsr,

    I usually integrate a Date/Time stamp into the workbook name but you may try using something like
    Please Login or Register  to view this content.
    If you give up what´s B7 holds we might come up with a different solution (maybe update the cell after saving the file).

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    11-15-2011
    Location
    Gastonia, NC
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: VBA to Rename if File Exists

    Holger,

    This worked great, thanks. B7 is just the user name, which should be different but if it not, i would need a new revision and not delete the old. The date/time stamp worked just as well, thanks for the idea.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Check if file exists and if so save file incremented by 1 e.g. filename(1).xlsm
    By ratdogexcel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2014, 01:15 AM
  2. check if file exists and opening it based on file date
    By JasperD in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-26-2014, 03:45 AM
  3. Task Scheduler Downloading an Empty, Bad File Before Actual File Exists...Not Good
    By jamesdeuce in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-23-2014, 01:25 PM
  4. [SOLVED] Rename Excel Worksheets, Add Variable if worksheet name already exists
    By jessello in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-22-2013, 05:38 PM
  5. Macro to ask to rename the file if one exists in the same location
    By debbiesh in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-11-2012, 01:54 PM

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