[AccessD] Office 10.0 Library vs. Office 9.0 Library

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Wed Feb 5 17:09:29 CST 2003


<<<
how does mine know to go to Ver 10 instead of Ver. 9?
>>>
Rocky,

As I wrote in addition to my first message - all MS Office object libraries have the same GUID - uuid(2DF8D04C-5BFA-101B-BDE5-00AA0044DE52) -all the rest is the COM "trick" - you should have on your PC in system registry under 

[HKEY_CLASSES_ROOT\TypeLib\{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}]

key only the description of Office 10 object library location or you've also Office 9 object library description/location and even Office 8 object library description/location etc. but Office 10 object library location is described/mentioned first in system registry - according to the COM rules it will be used as default  - nothing ''magical'/tricky at all...

Have a look in system registry at 
[HKEY_CLASSES_ROOT\TypeLib\{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}] key and its subkeys...

HTH,
Shamil

  ----- Original Message ----- 
  From: Rocky Smolin - Beach Access Software 
  To: accessd at databaseadvisors.com 
  Sent: Wednesday, February 05, 2003 8:08 PM
  Subject: Re: [AccessD] Office 10.0 Library vs. Office 9.0 Library


  Shamil:

  I understand.  About 30%. :)  

  But if as you say "Each version of MS Access "knows" its own version of MS Office type library - e.g. here is how MS Access 2000 "gets knowledge" that its Commandbars object is from MS Office 9.0 Object library:"  how does mine know to go to Ver 10 instead of Ver. 9?

  Rocky


    ----- Original Message ----- 
    From: Shamil Salakhetdinov 
    To: accessd at databaseadvisors.com 
    Sent: Wednesday, February 05, 2003 1:56 AM
    Subject: Re: [AccessD] Office 10.0 Library vs. Office 9.0 Library


    Rocky,

    CommandBars is a property of Access.Application object (default instance) - so there is no any need to search for "(hundreds) of registered references" - the code just gets the object ref (memory address) of already created collection Access.Application.CommandBars . Commandbars is a collection i.e. it supports COM's standard Collection interface(_NewEnum, Add, Remove, Item, Count)  + it has its own interface including FindControl method. Because of late binding FindControl is called via IDispatch COM interface of CommandBars coclass. IDispatch interface has GetIdsOfNames method, which is used to find the numeric Id of FindControl method. The info for IDispatch is stored in type library - for CommandBars this typelibrary is included into MS Office object library. Each version of MS Access "knows" its own version of MS Office type library - e.g. here is how MS Access 2000 "gets knowledge" that its Commandbars object is from MS Office 9.0 Object library:

    // typelib filename: msacc9.olb
    [
      uuid(4AFFC9A0-5F99-101B-AF4E-00AA003F0F07),
      version(9.0),
      helpstring("Microsoft Access 9.0 Object Library"),
      helpfile("acmain9.chm"),
      helpcontext(00000000)
    ]
    library Access
    {
        // TLib :     // TLib : Microsoft Visual Basic for Applications Extensibility 5.3 : {0002E157-0000-0000-C000-000000000046}
        importlib("VBE6EXT.OLB");
        // TLib : Microsoft ActiveX Data Objects 2.1 Library : {00000201-0000-0010-8000-00AA006D2EA4}
        importlib("msado21.tlb");
        // TLib : Microsoft Office 9.0 Object Library : {2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}
        importlib("MSO9.DLL");
    ....

    - importlib("MSO9.DLL") statement creates this static link in MS Access Object Library. IDispatch uses MS Office Object Library GUID ({2DF8D04C-5BFA-101B-BDE5-00AA0044DE52} for MS Office 9) statically written to MS Access object library to get (via system registry) location of MS Office Object library file, loads this object library and its typelib and finds numeric ID of FindControl method. Then marchalling is used to create parameters array and Fincontrol method is called using Invoke method of IDispatch interface... (It may happen that MS Office type library gets preloaded on MS Access start-up - I don't know these internal details but the nature of COM is to activate a feature/create object instances on first call to them only not in advance - so I guess that MS Office Object library is loaded when CommandBars collection is created during MS Access start-up or on first call to CommandBars collection, which can be the call from your code...)

    It looks a little bit complicated but it doesn't take that much time to care about or see any difference with early binding for two late bound calls as in your case...

    Hope this explains some late binding internal details,
    Shamil


    ----- Original Message ----- 
      From: Rocky Smolin - Beach Access Software 
      To: accessd at databaseadvisors.com 
      Sent: Wednesday, February 05, 2003 12:21 AM
      Subject: Re: [AccessD] Office 10.0 Library vs. Office 9.0 Library


      Shamil and Bryan:

      Thanks so much.  That was way too easy, :)

      But how does the program know which library to go to without searching all of those (hundreds) of registered references?

      I don't notice any pause at all.

      Best,

      Rocky Smolin
      Beach Access Software

        ----- Original Message ----- 
        From: Shamil Salakhetdinov 
        To: accessd at databaseadvisors.com 
        Sent: Tuesday, February 04, 2003 12:11 PM
        Subject: Re: [AccessD] Office 10.0 Library vs. Office 9.0 Library


        > How can I convert this to late binding?
        Rocky,

        This is easy - just use this code:

        Dim cbc As Object ' CommandBarControl
        Set cbc = CommandBars("Menu Bar").FindControl(ID:=4, recursive:=True)
        cbc.Enabled = False

        and remove the reference to the MS Office object library.

        HTH,
        Shamil
          ----- Original Message ----- 
          From: Rocky Smolin - Beach Access Software 
          To: accessd at databaseadvisors.com 
          Sent: Tuesday, February 04, 2003 10:35 PM
          Subject: Re: [AccessD] Office 10.0 Library vs. Office 9.0 Library


          Shamil:

          I'm having a little trouble finding enough help in Help and the ADH to figure out how to do late binding.  I'm currently using the following three lines to turn off the print button:

          Dim cbc As CommandBarControl
          Set cbc = CommandBars("Menu Bar").FindControl(ID:=4, recursive:=True)
          cbc.Enabled = False

          How can I convert this to late binding?

          (BTW, I'm trying to repair my Office installation now.  Maybe it will get rid of Version 10 and replace it with Version 9 which will solve the problem.)

          Best,

          Rocky

            ----- Original Message ----- 
            From: Shamil Salakhetdinov 
            To: accessd at databaseadvisors.com 
            Sent: Tuesday, February 04, 2003 10:25 AM
            Subject: Re: [AccessD] Office 10.0 Library vs. Office 9.0 Library


            Rocky,

            The only stable solution I know is to use late binding - then you'll not need a reference to Office 9 or 10.

            HTH,
            Shamil
              ----- Original Message ----- 
              From: Rocky Smolin - Beach Access Software 
              To: AccessD at databaseadvisors.com 
              Sent: Tuesday, February 04, 2003 7:30 PM
              Subject: [AccessD] Office 10.0 Library vs. Office 9.0 Library


              Dear List:

              In order to turn off the print button on the file menu I used the CommandBar object which required the Office Library.  I have Version 10.0.  My customer, however, has Version 9.0.  He doesn't have 10.0.  I don't have 9.0.  So now in the update we have to uncheck the 10.0 (missing) library, and check the 9.0 library. Awkward phone support at best.

              What's the best way around this?  Can I get 9.0?  Or can he get 10.0?  Or what?  They're running Office 2000.  Pro, I believe.


              MTIA

              Rocky Smolin
              Beach Access Software

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://databaseadvisors.com/pipermail/accessd/attachments/20030205/79840d3f/attachment-0002.html>


More information about the AccessD mailing list