Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Excel - Specify File Type in Save as (Excel 97-2003)

Excel - Specify File Type in Save as (Excel 97-2003)

Scheduled Pinned Locked Moved Visual Basic
questionhelpannouncementlearning
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RichardBerry
    wrote on last edited by
    #1

    Hi I need to save an Excel file as (Excel 97-2003) For the code below, I have a reference to Microsoft Excel 12.0 Object Library, which I assume is for Excel 2007. When I open a workbook saved as below, I get an error message saying the workbook is not in the expected format. Previously I used a reference to Excel 10.0 which worked fine, but I cannot find that anymore when adding references. I guess I have two choices: a) How do I reference Excel 10.0 Object Library? or b) In the code below, what do I replace "FileFormat As Object" with to specify that the file must be saved as an older Version? Private Sub ExportExcel() Dim xlApp As New Excel.Application Dim xlBook As Excel.Workbook xlBook = xlApp.Workbooks.Add 'Write stuff to book here... xlBook.SaveAs("MyBook.xls", "FileFormat As Object") xlBook.Close() xlBook = Nothing xlApp.Quit() xlApp = Nothing GC.Collect() End Sub

    R 1 Reply Last reply
    0
    • R RichardBerry

      Hi I need to save an Excel file as (Excel 97-2003) For the code below, I have a reference to Microsoft Excel 12.0 Object Library, which I assume is for Excel 2007. When I open a workbook saved as below, I get an error message saying the workbook is not in the expected format. Previously I used a reference to Excel 10.0 which worked fine, but I cannot find that anymore when adding references. I guess I have two choices: a) How do I reference Excel 10.0 Object Library? or b) In the code below, what do I replace "FileFormat As Object" with to specify that the file must be saved as an older Version? Private Sub ExportExcel() Dim xlApp As New Excel.Application Dim xlBook As Excel.Workbook xlBook = xlApp.Workbooks.Add 'Write stuff to book here... xlBook.SaveAs("MyBook.xls", "FileFormat As Object") xlBook.Close() xlBook = Nothing xlApp.Quit() xlApp = Nothing GC.Collect() End Sub

      R Offline
      R Offline
      RichardBerry
      wrote on last edited by
      #2

      Found my answer... Use one of the Interop.Excel.XlFileFormat formats Interop.Excel.XlFileFormat.xlExcel8 seems to work fine

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups