+ Reply to Thread
Results 1 to 7 of 7

Copy Workbook, Save and Rename

  1. #1
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    100

    Copy Workbook, Save and Rename

    I've done intensive research in Google, but no code worked for what I am trying to achieve here...

    Basically, I have a workbook with couple worksheets. I would like to copy the entire file (it's in .xlsm), create a copy, rename and save, and close my original.

    Any ideas how that would work?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Copy Workbook, Save and Rename

    What have you tried?

  3. #3
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    100

    Re: Copy Workbook, Save and Rename

    On that one for instance, I would like to change the extension to "xlsm" and eliminate the Save As pop up... Is that possible?

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    100

    Re: Copy Workbook, Save and Rename

    I like this code better; however, there appears to be an error with "ws.[A1].pastespecial paste:=xlvalue"
    Anybody know why??

    Please Login or Register  to view this content.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Copy Workbook, Save and Rename

    If the only problems with the first code is the prompt and file format that can easily be handled.

    For the format just change xlOpenXMLWorkbook to xlOpenXMLWorkbookMacroEnabled.

    You might need to change the filter in GetSaveAsFilename too.

    To get rid of the prompts add this at the start of the code.
    Please Login or Register  to view this content.
    Remember to reset alerts after the code.

  6. #6
    Forum Contributor
    Join Date
    04-11-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    100

    Re: Copy Workbook, Save and Rename

    @Nori, everything works fine now, except it's still asking whether I'd like to save as or not even though I put displayalerts code at several different places (beginning, middle, end, etc)... Is there another way of getting rid of prompts?

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,645

    Re: Copy Workbook, Save and Rename

    Where exactly did you put the code to suppress alerts?

+ 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