+ Reply to Thread
Results 1 to 5 of 5

Save As XLS format from Excel 2013 VBA - Workbook Version #

  1. #1
    Registered User
    Join Date
    07-01-2010
    Location
    Dallas, TX
    MS-Off Ver
    365 PC and Mac
    Posts
    64

    Save As XLS format from Excel 2013 VBA - Workbook Version #

    Hello- I've been using this code for a little while and its been fine.

    Setup: Office 2013 (latest updates) on Windows 7 Pro.

    - What it's supposed to do: Save a new worksheet as XLS (~version 2003).
    - Everything works fine and the sheet is saved in a new workbook.
    - When I try to open it, excel sometimes says the file does not match the file extension/file type. Reports it may be corrupt.

    Everything in the VBA seems to be fine... but I want to check this line of code with others:

    Please Login or Register  to view this content.
    Specifically, the excel version number
    Please Login or Register  to view this content.
    Any thoughts?

    Thanks for the help!

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Save As XLS format from Excel 2013 VBA - Workbook Version #

    Hi MrBill,

    Try something like the following code excerpt. Change to the code number for Excel 2003.
    Please Login or Register  to view this content.
    Lewis
    Last edited by LJMetzger; 01-31-2016 at 01:37 PM. Reason: Added reference link

  3. #3
    Registered User
    Join Date
    07-01-2010
    Location
    Dallas, TX
    MS-Off Ver
    365 PC and Mac
    Posts
    64

    Re: Save As XLS format from Excel 2013 VBA - Workbook Version #

    Hey Lewis- Thanks for the help.

    Is FileFormat=51 xls (Excel 2003)? I thought 51 is somewhere in the xlsx range (2007+).

    Also, if I use 'FileFormat' am I able to change it to:

    Please Login or Register  to view this content.
    This is where I think I'm getting tripped up.

    Thx for the help!

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Save As XLS format from Excel 2013 VBA - Workbook Version #

    Sorry for the confusion. The above code was for a file I saved as .xlsx which was type 51.

    Excel 2003 is type -4143 (xlWorkbookNormal). See https://msdn.microsoft.com/en-us/lib.../ff198017.aspx

    Please note that the Numbers have changed if using Excel 2016.

    Per Ron deBruin the numbers are slightly different when using MAC Excel.

    Ron also says that for Windows xlExcel8 = 56 works in Excel 2007+ to save the file as .xls. I have always used -4143.

    Lewis

  5. #5
    Registered User
    Join Date
    07-01-2010
    Location
    Dallas, TX
    MS-Off Ver
    365 PC and Mac
    Posts
    64

    Re: Save As XLS format from Excel 2013 VBA - Workbook Version #

    Hello- Thank you for the help. Appreciate the assistance. I implemented your versioning and it worked... sort of...

    After a whole bunch of testing, I found my version of Excel to be corrupt. I did a repair of office and it works consistently now. I'm keeping your version type since it seems to be working fine.

    Thanks again.

+ 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. Replies: 0
    Last Post: 01-09-2016, 02:02 PM
  2. Formulas not working in higher version, 2010 Version to 2013 version
    By thilag in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-19-2015, 09:09 PM
  3. BUG in excel 2013 version
    By laxmanann in forum Excel General
    Replies: 0
    Last Post: 09-28-2015, 06:20 AM
  4. Replies: 3
    Last Post: 04-24-2015, 08:30 AM
  5. Replies: 2
    Last Post: 04-11-2015, 12:44 AM
  6. excel version 2013 and 2007
    By dealer in forum Excel General
    Replies: 3
    Last Post: 06-10-2014, 08:22 AM
  7. Replies: 1
    Last Post: 04-05-2014, 01:09 AM

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