Results 1 to 3 of 3

Thread: [RESOLVED] Excel Versioning

  1. #1

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Resolved [RESOLVED] Excel Versioning

    I just spent a couple hours figuring out how to create a pivot table on an Excel spreadsheet via code. The reason I took so long is because I added a reference to the Excel Interop 12.0, rather than the Excel Interop 11.0.

    I assume that 12.0 is for Excel 2007, while 11.0 if for 2003 (or whatever I have). If that assumption is correct, this will cause me a bit of trouble, as all the people using the program are in the process of moving from 2003 to 2007, and I should have moved myself, but didn't for some reason unknown to me (I thought the upgrade was pushed out to my computer when I was at work, but I don't seem to have it anymore, so I guess I was dreaming).

    However, my concern is that the objects needed to create a pivot table in the 12.0 library are significantly different from the objects needed to create a pivot table in the 11.0 library. I don't believe I can late bind to solve this, because there will need to be different steps taken depending on the version, since the objects have different interfaces.

    Does anybody have any experience with this? It appears to pertain only to pivot tables (for what I'm doing), as I was able to create the workbook, the worksheets, and export all my data with some old code that I had, and all of that worked with both libraries, the difference is just with the pivot tables because the interfaces have changed, such that the methods needed for one library don't even exist in the other one (and the code crashes, but that's probably because I have the PIAs for 2003 installed, and not 2007).
    My usual boring signature: Nothing

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

    Re: Excel Versioning

    Yes, 12.0 is for 2007 and 11.0 is for 2003. 10.0 is for 2002 and 9.0 is for 2000.

    I would say Late Bind and use code like this to determine the version and branch off for the pivot table stuff accordingly.

    http://www.vbforums.com/showthread.php?t=402020
    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
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Excel Versioning

    That's what I was looking for, now that I think about it.
    My usual boring signature: Nothing

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