Adding help text to custom functions in Excel

  • Thread starter Thread starter jim4u
  • Start date Start date
J

jim4u

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.

Any help would be appreciated.....

Jim
 
This is the code I am using. I have tried both early and late binding.
I have also included the exceptions below.

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.MacroOptions(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("MacroOptions",
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"

Jim
 
Back
Top