none
Access to Com Object Model in an Xll Function RRS feed

  • Question

  • Hello
    A small question about access to the Excel Object model with Com in a Xll function...

    Xll Sdk does not allow access to the Excel Object model by Com. Nevertheless some development tools (Addin Express for example, Excel DNA?) allow you to load an xll in the same AppDomain as a Com Excel addin. This allows access from a global variable referencing the Excel application of the Com addin, then access the properties of different types of Excel object. According to the tests carried out this enable to access the value of the property of these objects (with the exception of the DisplayFormat property for conditional fomats - but this can be understandable because based on another level of calculation). This makes it possible to create functions just as it's done with VBA or COM Automation getting object properties values. Of course you can set properties or run method on Object (But you can't also in VBA/COM UDF: most of the time it fails..)

    Microsoft once recommended not accessing Excel Object model in a xll. Nevertheless this information page has disappeared (Search> kb/301443) and in practice it seems to work...

    My question is: Is there a risk to access properties of Com Excel Object model in a Xll function ?
    What mechanism could during the calculation of a function allow the use of the Excel model in VBA/Com and prevent it in a Xll? Are there any known examples where users have reported that Excel crash because of the use of such functions ?

    (As this question is linked to Excel calculation process, i would really appreciate any answser of any excel dev team member)

    Thanks a lot,

    Regards, Xavier



    • Edited by Xavier N Friday, March 13, 2020 2:52 PM
    Friday, March 13, 2020 9:46 AM

Answers

  • Hello Xavier,

    I'm not from the Excel dev Team,

    but I use the  Com Excel Object also in a XLL.

    The claimed to access the Com Excel Object model only in xll functions defined as commands otherwise Excel may crash,
    but this should also work if the xll function is defined as worksheet equivalent.

    best regards

      Hendrik Schmieder

    • Marked as answer by Xavier N Saturday, March 21, 2020 6:58 AM
    Friday, March 20, 2020 3:33 PM

All replies

  • Hello Xavier,

    I'm not from the Excel dev Team,

    but I use the  Com Excel Object also in a XLL.

    The claimed to access the Com Excel Object model only in xll functions defined as commands otherwise Excel may crash,
    but this should also work if the xll function is defined as worksheet equivalent.

    best regards

      Hendrik Schmieder

    • Marked as answer by Xavier N Saturday, March 21, 2020 6:58 AM
    Friday, March 20, 2020 3:33 PM
  • Thanks a lot for your experience feedback Hendrick,

    Best Regards

    Xavier

    Saturday, March 21, 2020 7:00 AM