Results 1 to 8 of 8
  1. #1
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Running with missing references (VB6)

    Hi all, quick references question for you:

    Will an application run fine with missing references if it doesnt actually run the code that requires the reference? i.e. I have a bit of code to choose a Worksheet from an Excel spreadsheet, but only customers that have Excel installed will be using that functionality - will customers not using that part of the program still be able to use the rest of it without error? I know if it was MS Access it would be unlikely to run very well at all.

    Regards,
    Phil

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Running with missing references (VB6)

    I don't know the answer (I don't have VB6 at the moment) but why not use late binding? That way, users without Excel wouldn't have problems (as long as they don't try to use the code that manipulates Excel).

  3. #3
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running with missing references (VB6)

    Doh, I keep forgetting about late binding. I've only ever used it once as most of my programming has been for internal use where we have full Office 2003 (or 2000 in years past), hence I always forget that it is a good alternative to referencing objects that won't always be used.

    This will probably fix a number of issues i'm currently having so thanks loads Hans.

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running with missing references (VB6)

    Instead of, ugh!, late binding, isolate the Excel specific code in modules that will not be referenced.

    And/or, to play safe, test whether Excel has been installed and skip any calls to those modules.

  5. #5
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running with missing references (VB6)

    So referencing the object but making sure all of the code relating to it is isolated in its own module would avoid any issues where the Excel dlls are missing? Would putting it in a dll be any better, or would the missing dependancies (excel) of that dll make the main app throw a wobbly?

    I'll probably get a slap on the wrist for this statement but I preferred working with potentially missing DLLs in Access as you could add and remove references on the fly in that - much less hastle! * Phils cowers, waiting for the backlash *

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running with missing references (VB6)

    Putting code in a DLL is usually better, but the DLL has to have the reference, otherwise the DLL will not compile.

  7. #7
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running with missing references (VB6)

    > if it doesnt actually run the code that requires the reference?
    I looked at this here.
    I have a similar problem where I have options within an application that are dependent on another Word project (dot) being present.

    I found a process of isolating some test code in a separate module.

  8. #8
    4 Star Lounger
    Join Date
    Feb 2001
    Location
    Gillingham, Kent, England
    Posts
    511
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Running with missing references (VB6)

    I had a brief read - that sounds like it would be ideal! Thanks Chris.

    I'll have a more in depth look when I get a sec (sec not being in the literal sense!).

Posting Permissions

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