+ Reply to Thread
Results 1 to 4 of 4

Macro that copies workseet into new book saves as broken unless converted first

  1. #1
    Registered User
    Join Date
    03-07-2016
    Location
    Michigan, USA
    MS-Off Ver
    Office 365
    Posts
    12

    Macro that copies workseet into new book saves as broken unless converted first

    Hello all!

    I have been looking into making a macro that copies a sheet into a new workbook for a whole month. In perusing the site i found an old thread that had this same issue. With a little tweaking to make it suit my needs i was able to have it run the macro for all 14 sheets i need just fine. It isn't until after i ran all of them that i noticed i could not open them once closed. The error i would receive stated "Excel cannot open the file 'FILE NAME' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.". I then noticed if i go to save the file once ran before closing it i can convert it to the new format and i do not have this issue. Is there a macro that will automatically convert to the newest format and save so i do not have this issue again OR is there an old part of this code that needs updated?

    Below find the code.

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Macro that copies workseet into new book saves as broken unless converted first

    If you are using latest version of Excel (and assuming that you don't want to save as macro enabled xlsm files), you probably need to use Fileformat:=xlOpenXMLWorkbook

    You can use FileFormat:=51 as a shorter method.

  3. #3
    Registered User
    Join Date
    03-07-2016
    Location
    Michigan, USA
    MS-Off Ver
    Office 365
    Posts
    12

    Re: Macro that copies workseet into new book saves as broken unless converted first

    Quote Originally Posted by shirleyxls View Post
    If you are using latest version of Excel (and assuming that you don't want to save as macro enabled xlsm files), you probably need to use Fileformat:=xlOpenXMLWorkbook

    You can use FileFormat:=51 as a shorter method.
    This was my exact problem! Thank you shirleyyxls, you've saved me a huge headache.

  4. #4
    Valued Forum Contributor
    Join Date
    01-08-2011
    Location
    Portsmouth, England
    MS-Off Ver
    Excel 2007 to 2016
    Posts
    456

    Re: Macro that copies workseet into new book saves as broken unless converted first

    Glad to have helped.

    Excel is a constant learning process and it's great to help each other. If I've helped you today, a click on the star on the left is appreciated.

+ 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. Macro to use some sort of ifstatement, and paste on new workseet tab
    By kamran_ijazz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-06-2012, 03:01 PM
  2. Replies: 4
    Last Post: 11-28-2012, 11:44 AM
  3. Replies: 1
    Last Post: 07-12-2012, 11:00 PM
  4. [SOLVED] macro to replace numbers in workseet with corresponding values in another worksheet
    By vbvamsi in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-01-2012, 05:53 AM
  5. Worksheet scrolling with scroll wheel is broken! (1 sheet in book)
    By Cicatrize in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 10-23-2008, 02:15 AM
  6. macro/workseet/graph interaction
    By nc10001 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2005, 10:05 AM
  7. Make Macro go to Next Workseet
    By Michael from Austin in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-02-2005, 07:06 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