+ Reply to Thread
Results 1 to 4 of 4

VBA code to save spreadsheet as xls

Hybrid View

Blokeyfella VBA code to save spreadsheet... 10-26-2020, 09:33 AM
torachan Re: VBA code to save... 10-26-2020, 10:03 AM
CK76 Re: VBA code to save... 10-26-2020, 10:03 AM
Blokeyfella Re: VBA code to save... 10-26-2020, 11:15 AM
  1. #1
    Registered User
    Join Date
    10-26-2020
    Location
    London, England
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    2

    VBA code to save spreadsheet as xls

    Hi All

    I've written a macro that chops up a bunch of data and then creates a report before exporting it. All works as it should on my machine.

    However, my customer requires the files to be saved as "Excel Workbook" not "Excel 97-2003 Workbook"

    They are using Excel 2016, I'm using Excel for MS 365 MSO

    I've tried saving file format as xlExcel8, 56 etc but all of them save down as Excel-97-2003 Workbook

    Code I've used is:

    ActiveWorkbook.SaveAs Filename:=RepName, FileFormat:=56, CreateBackup:=False

    Is someone able to confirm how I can save as xls but not 97-2003? Or am I missing something bigger?

    Thanks very much
    Blokeyfella

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,411

    Re: VBA code to save spreadsheet as xls

    Excel Workbook is .xlsx not .xls

    try FileExtStr = ".xlsx": FileFormatNum = 51

  3. #3
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: VBA code to save spreadsheet as xls

    files to be saved as "Excel Workbook" not "Excel 97-2003 Workbook"
    You mean that you need to save file as .xlsx format?
    You should use 51 or xlOpenXMLWorkbook.

    Note that RepName string should either match save as file type, or leave out extension.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

  4. #4
    Registered User
    Join Date
    10-26-2020
    Location
    London, England
    MS-Off Ver
    Excel for MS 365 MSO
    Posts
    2

    Re: VBA code to save spreadsheet as xls

    Gaaaah!!!
    What an idiot.

    Apologies and thanks very much - combination of setting .xls in the RepName variant and also using the wrong fileformat number

    Schoolboy!

    Appreciate the replies, thanks very much!!

+ 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. Command Box Code to save a specific spreadsheet
    By exceldisciple in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-07-2020, 11:56 PM
  2. Save Excel Spreadsheet But Not Code
    By SEOT in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-10-2009, 04:08 PM
  3. Save spreadsheet with VBA code
    By DeMus in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2007, 12:57 PM
  4. [SOLVED] vb code to save a spreadsheet to file
    By ASU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-06-2006, 02:00 AM
  5. Code to save spreadsheet
    By FrigidDigit in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2005, 02:05 AM
  6. [SOLVED] How to save excel spreadsheet and word doc with one save
    By CEP in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-29-2005, 06: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