Results 1 to 11 of 11

Thread: Saving an Excel 2007 worksheet but in 2003 format?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Saving an Excel 2007 worksheet but in 2003 format?

    Hi all
    I'm creating a new worksheet using Excel 2007 and then i save it to file. How would i be able to specify the format to be compatible with Excel 2003?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    Hey MP hows it going? Long time no post lol.

    Just open the workbok and raise the .SaveAs passing "xlExcel8" as the FileFormat argument.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    Hi Rob,
    for some reason it crashes when i try that. It works if I try xlWorkbookNormal, but if i try xlExcel8 it throws:
    {System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC

    any ideas?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  4. #4
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    Running any plugins in Excel 2007? Sounds like one of them crashed or didn't respond too well to the command
    If you found any of my posts helpful then please rate them.

    CodeBank

    Form Fading Effects in VB.NET and C#

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    I dont have 2007 at this location so I can check it tonight.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    nope it's a plane installation
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    Hi,

    You don't by any chance have something like Acrobat installed do you?

    Sam
    If you found any of my posts helpful then please rate them.

    CodeBank

    Form Fading Effects in VB.NET and C#

  8. #8

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    hmm yea i have acrobat reader... why?
    Funny thing is using this format works fine: xlExcel9795
    Is there any particular reason why that version would work and excel 8 wouldnt work? is there any downside in using the older 9795 version?


    edit: uuh okay i tried xlExcel9795 on another computer that has office 2007 installed on it, and it throws that exception. It runs fine on the computer that has office 2003 installed on it
    Last edited by MrPolite; Aug 1st, 2008 at 08:14 PM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  9. #9

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    this works so far, but it seems more like a "hack" to me... anyone can tell me why this is failing depending on what version of office I'm running?
    PHP Code:
                if (app.Version == "11.0")
                    
    format Excel.XlFileFormat.xlWorkbookNormal;    //This format would throw an exception if the machine has office 2007
                
    else if (app.Version == "12.0")
                    
    format Excel.XlFileFormat.xlExcel8;                 //This would throw an exception if we're running office 2003 
    (yea that's C# but it looks 'near' identical in VB )
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  10. #10
    Hyperactive Member
    Join Date
    May 2007
    Posts
    279

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    Hi,

    In Office 2003, you can save as:

    - 2003
    - 2002

    In Office 2007 you can save as either:

    - 2007 (docX) file
    - 97-2003 (doc file)

    So saving in 2007 it is at lowest 8 and at highest 11, try saving as either ver 8 or ver 11.

    My theory about Acrobat was just an instability but it seems more of an Office issue.

    Office 2007 treats all backward compatible documents as the same class unlike Office 2003 (although if you have Office 2007 on the same it changes behaviour).

    You will have to use your hack
    If you found any of my posts helpful then please rate them.

    CodeBank

    Form Fading Effects in VB.NET and C#

  11. #11

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: Saving an Excel 2007 worksheet but in 2003 format?

    aah i see
    well thanks for your help!
    hopefully this works fine for now
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width