ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using UDF in COM Addin as formula in worksheet (https://www.excelbanter.com/excel-programming/275968-using-udf-com-addin-formula-worksheet.html)

Ralf Zimmermann

Using UDF in COM Addin as formula in worksheet
 
I have written a COM addin in VB to store user defined data in
CustomDocumentProperties of a workbook. Now i want to insert these props in
a cell
like

Application.ActiveCell.FormulaR1C1 = "=GETPROPERTY(""" &
sPropertyName & """)"

It works if i define the GETPROPERTY function directly in a module of
workbook, but i want to define this function in the COM addin without
writting a wrapper XLA. (see MSDN KnowledgeBase article Q256624 - Howto: Use
a COM Add-In Function as an Excel Worksheet function)

Is this possible???

Thanks in advance.Ralf



Tom Ogilvy

Using UDF in COM Addin as formula in worksheet
 
Can you make your function a DLL/xll rather than a COM Addin.
http://msdn.microsoft.com/library/en...icedev_topic16

I think you can call that directly, but the article starts out:

Microsoft Excel 2000 cannot call a function directly in a COM Add-in from a
worksheet cell formula. However, you can create a Visual Basic for
Applications (VBA) wrapper for the COM Add-in function so that the function
may be called indirectly.

If you are using xl2002, then you can use an Automation-Addin
Create a Visual Basic Automation Add-in for Excel 2002 Worksheet Functions
(Q285337)


--
Regards,
Tom Ogilvy

"Ralf Zimmermann" wrote in message
...
I have written a COM addin in VB to store user defined data in
CustomDocumentProperties of a workbook. Now i want to insert these props

in
a cell
like

Application.ActiveCell.FormulaR1C1 = "=GETPROPERTY(""" &
sPropertyName & """)"

It works if i define the GETPROPERTY function directly in a module of
workbook, but i want to define this function in the COM addin without
writting a wrapper XLA. (see MSDN KnowledgeBase article Q256624 - Howto:

Use
a COM Add-In Function as an Excel Worksheet function)

Is this possible???

Thanks in advance.Ralf






All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com