Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    I'm more than a little confused by how the XL object can be used by VB6..

    I have Office XP developer's edition installed and I also have XL 2000 (not the developer edition) installed.

    When I go to add a reference to XL in VB I only see the 10.0 Object Library as being avail. Do you only get the object when you have the devloper's edition? The reason that this came up is that I'm writing a app in VB6 to build an XL sheet and am having trouble with the Workbooks.OpenText method on user's machines that only have XL 2k (it generates and address error in the vb runtime - runs fine on my XL XP machine).

    If it turns out I have to use the XL 2K Object Library - how do these libraries get loaded?

    It would be nice if I could just use my 10.0 Obj Lib and not have to worry about what the target user has.. what do I need to distribute with my app in order that it will run on a user's machine so that they don't have to go out and purchase the version of XL that I have?

    Or if you have any other ideas I'm open..

    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    You get the object libraries for the versions you have installed. If you're looking for the Excel Object Library for version 9 and you have XL 2000 installed, it should be there, although you may have to browse for it. The Excel 9 object library is named Excel9.olb.
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Thank you! I was able to find that lib.

    Do you happen to know anything about this part of my question:

    "It would be nice if I could just use my 10.0 Obj Lib and not have to worry about what the target user has.. what do I need to distribute with my app in order that it will run on a user's machine so that they don't have to go out and purchase the version of XL that I have?"

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    I've never tried distributing an Excel application, but the packaging and deployment wizard (or whatever it's called in XP) should be able to package it for you and create a setup that can be installed on the target machine. It is an add-in in 2000 (and I assume in XP) and you can get to it from the VBE interface. The wizard will walk you through creating the setup.
    Charlotte

  5. #5
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Thanks again.

    Yes, I know about the packaging wiz and was stuck on the notionthat since its not a true XP app (not using a macro) that I was in trouble. Your post got me to thinking that I could come up with a "hello world" app and distribute that along with my VB app to get the job done.

    Whadya think?

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    VB also has the packaging and deployment wizard, and since XP is still based on VB6, it should work for either one.

    I don't know what you mean about not using a macro, though. The wizard doesn't care what's in the file, it just packages the app file the way you tell it to. There doesn't have to be any code involved.
    Charlotte

  7. #7
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    I guess I was confusing potential licensing issues with the 'no macro" statement. After reading your response it looks like I'm tilting at windmills.

    Thanks for your patience!

  8. #8
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Now *I'm* confused. You can't distribute the Excel executable, but you can distribute an Excel spreadsheet, along with the VB6 runtime, and I thought that was what you wanted to do, along with the libraries that supported it. A later version of Excel will open an earlier version's worksheets but if you had code in your VB project that referenced a particular library version, you would need that library on the setup CD or you would have to write code to handle the broken references.
    Charlotte

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    The issue you're flirting with is versioning of dependencies and is a whole topic in itself, but for your case, you need to code your app against the version of Excel which the users have. Don't try and package Excel with your application or you'll have lawsuits from Redmond coming your way <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    If you are using methods that are common across xl9 and xl10, or even older versions, then instead of referencing the library, you could use CreateObject("Excel.Application") and that will give you an application instance in whatever version the user has. You just have to test your code against xl9 and xl10 to make sure the methods you are using work in both. For testing purposes, you could change your code to CreateObject("Excel.Application.9") and CreateObject("Excel.Application.10") temporarily, or using conditional compilation.

  10. #10
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Are you saying that even though I have Excel XP Developer Edition that I can't package a simple spreadsheet along with my VB app and install them on a user's machine (legally)? Or it just won't work? Or Both?

    I've been trying to make my app compatible all the way back to xl8 and now seems to work ok. I'm still using the early binding approach and switching between references of xl8 and xl10. Am I heading for trouble using early binding instead of late?

  11. #11
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    You can package the spreadsheet, but you can't include the Excel executable. If you want to use automation, early binding makes it much easier.
    Charlotte

  12. #12
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Yes. That has been my understanding all along and that is my current approach.

    However, I've been getting an error message from the XL Packaging Wiz: WIth "offWH" in the title bar I get a message box with "Error In Loading DLL". I've re-installed the product but am still getting the same thing.

    I don't suppose you have any idea as to what's going on? I've searched all of msft's web site and no help there.

    If I click the OK button it seems to build a distribution set but at this point I've not tested it. I'll need a test machine to do that and I don't have one avail yet.

  13. #13
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Early binding makes programming easier, but it makes your app depend on the referencd binaries being on the machine.

    If your users have anything from xl8 to xl10 on their machines, then your going to have to use late binding and CreateObject, and make sure your code works on all 3 versions.

  14. #14
    Star Lounger
    Join Date
    Sep 2001
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    Are you missing the fact that I will be distributing the app using the Packaging Wizard? Do you still maintain that your statements are factual? If so please explain why..

    Also, based on some testing where I've sent only the vb program (with early binding to xl 10) to a user that has some machines with xl 8 and xl 9 and they do in fact work. At first they didin't due to some features that are only avail in xl xp but when I removed them they worked. So, I am more than a little confused by all of this.

  15. #15
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Understanding XL Ref in VB6 ..?? (vb6 XL various versons)

    The fact that you are using the packaging wizard makes no difference at all. The packaging wizard include files that your project is dependent on, but only up to a limit. After all, your project depends on Windows itself, but Windows doesn't get packaged with it. This basically means Excel doesn't get packaged with your project, and you wouldn't want it to, since you'd be distributing one of Microsoft's major products for free with your app.

    The reason that your project works with xl8 and 9 when packaged early bound against xl10, is because MS have made the Excel libraries binary compatible, and that's one thing I didn't think of when I posted previously, apologies for that. This basically means that the xl8,9 and 10 libraries use the same CLSIDs (Classs identifiers) and so they will look the same to your VB project when it's running on a machine with any of those versions installed, the only difference being that the later versions will have some added classes and methods. So, the only thing that will fail is when you try and use methods available in 10 that aren't in 8 or 9, like you say.

    Hope this makes it a bit clearer.

Page 1 of 2 12 LastLast

Posting Permissions

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