XLL+ Class Library (7.0)

CXlToolbar::AddTool

Adds a new tool button to a toolbar

static BOOL AddTool(
   const TCHAR* pszToolbarName,
   short int nPosition,
   const TCHAR* pszMacro,
   const TCHAR* pszStatusbarText,
   short int nToolID = 220,
   bool bDown = false,
   bool bEnabled = false,
   const TCHAR* pszHelpTopic = _T(""),
   const TCHAR* pszTooltipText = _T("")
);
static BOOL AddTool(
   short int nToolbarID,
   short int nPosition,
   const TCHAR* pszMacro,
   const TCHAR* pszStatusbarText,
   short int nToolID = 220,
   bool bDown = false,
   bool bEnabled = false,
   const TCHAR* pszHelpTopic = _T(""),
   const TCHAR* pszTooltipText = _T("")
);

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