By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,986 Members | 1,944 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,986 IT Pros & Developers. It's quick & easy.

Add help text to custom functions in Excel

P: n/a
Hi gurus,

I have an automation add-in created using C# for Excel, in which I am
exposing a number of functions. Is there any way I can add help-text
the way excel does for other categories like Financial, Statistical,
etc.

The place I want my help-text to be available is in the
Insert->Function. Here, we can select a category and function. The
corresponding help text is displayed. Now, my automation add-in is
also listed in this categories. I want help text to be displayed when a
user selects my add-in and functions in it.

I tried the MacroOptions method, but it is raising an exception.

This is the code I tried (I tried both early binding and late binding):

early binding:

code:

_excelApplication.MacroOptions("Report_Alloc", "custom description",
Missing.Value,
Missing.Value, Missing.Value, Missing.Value, "Report.Report", Missing.Value,
Missing.Value, Missing.Value);

Exception Message: "Exception from HRESULT: 0x800A03EC."
StackTrace " at
Microsoft.Office.Interop.Excel._Application.MacroO ptions(Object Macro, Object
Description, Object HasMenu, Object MenuText, Object HasShortcutKey, Object
ShortcutKey, Object Category, Object StatusBar, Object HelpContextID, Object
HelpFile)\r\n at .......

late binding:

code:

object[] parameters = new object[10];
parameters[0] = "Report_Alloc";
parameters[1] = "Some sample description...";
parameters[2] = Missing.Value;
parameters[3] = Missing.Value;
parameters[4] = Missing.Value;
parameters[5] = Missing.Value;
parameters[6] = "Report.Report";
parameters[7] = Missing.Value;
parameters[8] = Missing.Value;
parameters[9] = Missing.Value;

_excelApplication.GetType().InvokeMember("MacroOpt ions",
BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance,
null, _excelApplication, parameters, new
System.Globalization.CultureInfo("en-US"));

Exception Message: "Exception has been thrown by the target of an invocation."
StackTrace " at System.RuntimeType.InvokeDispMethod(String name,
BindingFlags invokeAttr, Object target, Object[] args, Boolean[]
byrefModifiers, Int32 culture, String[] namedParameters)\r\n at
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder
binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)\r\n at ......
Inner Exception Message: "MacroOptions method of Application class failed"
Any help would be appreciated.....
Jim
work smart, not hard!
Mar 20 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.