Hello Dave,
From your post, my understanding on this issue is: you wonder how to add a
UDF to a COM addin, and how to use multiple UDF in one Excel cell. If I'm
off base, please feel free to let me know.
For the first question about how to add a UDF to a COM Addin, first off, I
hope to let you know that COM addin itself is not able to do it. There can
be two, not very perfect, workarounds:
Workaround 1. Write, or convert the COM addin to an automation add-in:
http://support.microsoft.com/kb/285337
http://www.codeproject.com/KB/COM/excelnetauto.aspx
However, automation addins only support "Load on Demand". That's why I said
it's not perfect workaround. we recommend that users should manually
enable/activate the automation add-ins that they are really in need of.
However, if you insist on automatically activate the Automation Add-in when
Excel is loaded, there is an undocumented and unsupported method to do that
for your reference:
According to the section "Automation Add-ins" in
http://support.microsoft.com/kb/291392, when you make additions to the list
in the Add-Ins dialog box or when you select and clear Add-ins in the list,
Excel stores your changes in the registry. First, Excel uses the following
registry setting to determine whether or not an Automation Add-in in the
Add-in list is loaded:
Key: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Options String:
OPENx Sample Value: /A "ServerName.ClassName"
Here, 'x' in OPENx is an id to differentiate between multiple OPENs. For
instance, suppose we have two Excel Automation Add-ins
(AutomationAddin.XLFunctions and AutomationAddin.XLFunctions2) that have
been activated, then we will find two OPEN entries in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Options
OPEN /A "AutomationAddin.XLFunctions"
OPEN1 /A "AutomationAddin.XLFunctions2"
Therefore, if we want to activate the Automation Add-in automatically, what
we need to do is to add an entry of OPEN (be careful about the x) in the
registry:
HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Excel\Options
when the add-in is installed. That is to say, we should customize the setup
project to write the registry key.
Workaround 2. Still use COM addin, but we need an additional Excel add-in
(xla) to call the public function in the COM Addin
http://support.microsoft.com/kb/256624/
I said this workaround is not perfect because it requires an additional xla
file.
For the second question about how to use multiple UDF in one cell, we can
write the formula of the cell as:
=DAVE(hi there)&" between "&DAVE(hello)
& is used to concat the strings.
If you have any other concerns or questions, feel free to let me know.
Regards,
Jialiang Ge (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.