XLL+ Class Library

CXlToolbar::AddTool

Adds a new tool button to a toolbar

[C++]
static BOOL AddTool(
   const char* pszToolbarName,
   short int nPosition,
   const char* pszMacro,
   const char* pszStatusbarText,
   short int nToolID = 220,
   bool bDown = false,
   bool bEnabled = false,
   const char* pszHelpTopic = "",
   const char* pszTooltipText = ""
);
static BOOL AddTool(
   short int nToolbarID,
   short int nPosition,
   const char* pszMacro,
   const char* pszStatusbarText,
   short int nToolID = 220,
   bool bDown = false,
   bool bEnabled = false,
   const char* pszHelpTopic = "",
   const char* pszTooltipText = ""
);

Parameters

pszToolbarName

The name of the toolbar.

This argument can contain a resource ID string. This will be replaced at run-time by a string loaded from the resource file in the current preferred language, as returned by XllGetStringLanguageID.

nPosition

The desired index of the tool button within the toolbar.

pszMacro

The name of the macro function which will be run when the button is pushed.

pszStatusbarText

The text which will appear in the status bar when the toolbar is selected. This is ignored by most versions of Excel.

This argument can contain a resource ID string. This will be replaced at run-time by a string loaded from the resource file in the current preferred language, as returned by XllGetStringLanguageID.

nToolID

The index of the tool button's bitmap within Excel's list of built-in bitmaps.

bDown

Sets whether the tool is initially shown in the down state.

bEnabled

Sets whether the tool is initially enabled.

pszHelpTopic

The name of a help topic in the add-in's current help file.

pszTooltipText

The text which will appear when the mouse hovers over the button. Note that this text will only be visible in Excel if "Show ScreenTips on toolbars" is enabled in the "Options" tab of the Excel Tools/Customize dialog.

If omitted, then pszStatusBarText will be used.

This argument can contain a resource ID string. This will be replaced at run-time by a string loaded from the resource file in the current preferred language, as returned by XllGetStringLanguageID.

nToolbarID

The unique identifier of the toolbar.

Return value

Returns TRUE if the tool was successfully added, and FALSE if the function failed.

Remarks

Adds a new tool button to a toolbar.

Requirements

Header: xltoolbar.h

See Also

CXlToolbar Class | CXlToolbar Methods