+ Reply to Thread
Results 1 to 5 of 5

Copy this File As (This workbook Path + Name + Phrase + (V)arriant #)

  1. #1
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Copy this File As (This workbook Path + Name + Phrase + (V)arriant #)

    Without changing the current open file name,
    Save a copy of the file as specified in title.

    The version number V should be attached to the end of the file.

    If the name exists, the version number should be incremented by one.

    Example:
    Active workbook = C:\test\book.xls

    Save copy as : C:\test\bookphrase1.xls
    If C:\test\bookphrase1.xls exists, proceed to C:\test\bookphrase2.xls etc.

    I am a NOVICE on vba, so please do not laugh, at least I tried:

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor spitfireblue's Avatar
    Join Date
    01-29-2015
    Location
    Adelaide, Australia
    MS-Off Ver
    2007,2010,2016
    Posts
    611

    Re: Copy this File As (This workbook Path + Name + Phrase + (V)arriant #)

    Hi,
    No one is going to laugh, you did a pretty good job if you rate yourself as a novice!
    A few things...
    • ThisWorkbook.FullName - this will pickup the file extension as well i.e. Book.xls not just Book
    • To combine strings you need to use & instead of +
    • Your Exit Do is in the wrong place. You want to exit after you save the file.
    Try this:
    Please Login or Register  to view this content.
    Regards,
    Stephen

    If you feel someone has helped you please thank them and click on the star on their post to add reputation.
    Please ensure that you use code tags where relevant, and mark solved threads as solved.
    Most of all please be respectful and understanding of others.

  3. #3
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Copy this File As (This workbook Path + Name + Phrase + (V)arriant #)

    Thank you Stephen for pointing out and explaining the errors.

    It seemed to be executing, no errors, BUT there was no file in the dir...
    Found it after disk search, it went in "MyDocuments"
    Any idea why?

  4. #4
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Copy this File As (This workbook Path + Name + Phrase + (V)arriant #)

    MsgBox (saf) before Do only shows "book". Path is missing.

  5. #5
    Forum Contributor
    Join Date
    01-20-2014
    Location
    Greece
    MS-Off Ver
    20 yr. old Excel 2002!
    Posts
    710

    Re: Copy this File As (This workbook Path + Name + Phrase + (V)arriant #)

    ok. Found it.

    Please Login or Register  to view this content.

+ 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. Find a phrase in file, copy another value on the same line to another file
    By exseller in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-18-2015, 06:32 AM
  2. [SOLVED] Need Copy file name and contents of that file in a specified path
    By punna111 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 02-12-2014, 10:37 AM
  3. Replies: 5
    Last Post: 03-21-2013, 07:34 AM
  4. [SOLVED] Get file path from a cell, run a check to see if the file has a specific sheet if yes copy
    By Martha44 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-04-2013, 03:35 AM
  5. Using a cell reference as a file path to a workbook
    By SandyUK in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-16-2012, 02:45 PM
  6. Shorten File Path To Access Workbook
    By JimmiOO in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-24-2010, 11:26 AM
  7. how to set a workbook from a file name and path
    By lvcha.gouqizi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-21-2005, 05:05 PM

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