如何向我的自定义Excel功能区UI添加工具提示?

时间:2018-07-31 18:31:08

标签: xml excel vba excel-vba user-interface

This may be a duplicate,但是我无法使此功能正常工作。使用该答案中找到的XML。

如何将自定义工具提示添加到Excel功能区?我正在使用Custom UI Editor for Microsoft Office,我的代码如下:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<ribbon>
    <tabs>
        <tab id="customTab" label="Quoting Utilities" insertBeforeMso="TabHome">

            <group id="CGImportingFiles" label="Importing Files">
                <button id="ImportOpenWorkbook" label="Import Open Workbook" size="large" imageMso="InfopathExportToExcel" onAction="CGCImportOpenWorkbook" screentip="Title" supertip="Imports the data from an open workbook" />
                <button id="ImportSavedWorkbook" label="Import Saved Workbook" size="large" imageMso="FormExportToExcel" onAction="CGCImportSavedWorkbook" supertip="Imports the data from a saved workbook" />
                <button id="ImportFromClipboard" label="Import From Clipboard" size="large" imageMso="PasteSingleCellTableAsTable" onAction="CGCImportFromClipboard" supertip="Pastes the clipboard contents" />
                <button id="ClearDataTable" label="Clear Data Table" size="large" imageMso="NewTableStyle2" onAction="CGCClearDataTable" supertip="Clears all data within the data table" />
            </group>
            <group id="CGCleaningData" label="Cleaning Data">
                <button id="UnmergeConsolidate" label="Unmerge Selection and Consolidate" size="large" imageMso="CatalogMergeCreateList" onAction="CGCUnmergeConsolidate" supertip="Unmerges all cells within the selection. If doing so would leave any empty rows or columns, delete them" />
                <button id="CropSelection" label="Crop Selection" size="large" imageMso="PageFitToDrawing" onAction="CGCCropSelection" supertip="Deletes all data in the sheet which is outside the current selection. Selection is moved to A1" />
                <button id="RemoveSpecialChars" label="Remove Special Characters" size="large" imageMso="WordCount" onAction="CGCRemoveSpecialChars" supertip="Removes all non-keyboard characters within selection (depends on header datatype)" />
                <button id="RangeAssign" label="Assign Value to Range" size="large" imageMso="EnableInlineEdit" onAction="CGCRangeAssign" supertip="Assign one value to each cell in a range of cells" />
            </group>
            <group id="CGDataCategories" label="Header Functions">
                <button id="ResetColumnHeaders" label="Reset Column Headers" size="large" imageMso="FieldChooser" onAction="CGCResetColumnHeaders" supertip="Clears all header selections" />
                <button id="ClearBlankHeaders" label="Clear Blank Headers" size="large" imageMso="CrossFunctionalFlowchartVerticalDirection" onAction="CGCClearBlankHeaders" supertip="Replaces all blank header selections with actual blanks (a hyphen -> a blank)" />
                <button id="ValidateColumnSelections" label="Validate Column Headers" size="large" imageMso="ReviewRevisionAccept" onAction="CGCValidateColumnSelections" supertip="Check that all required headers exist, that no header is duplicated, that every header has data, and that all data has a header" />
                <button id="SortIntoStandardFormat" label="Sort Columns by Std Order" size="large" imageMso="ArrangeTools" onAction="CGCSortIntoStandardFormat" supertip="Sort data into the standard format, based on headers" />
            </group>
            <group idMso="GroupEnterDataAlignment" />
            <group idMso="GroupEnterDataNumber" />
            <group idMso="GroupClipboard" />
            <group idMso="GroupAlignmentExcel" />
            <group idMso="GroupCells" />                                
            <group idMso="GroupEditingExcel" />
        </tab>
    </tabs>
</ribbon>

请注意,第一个按钮(ImportOpenWorkbook)同时具有screentip =“ Title”和supertip =“ Imports from a open workbook”标记中的数据。其余按钮仅具有supertip标签。我还尝试了 only (包括screentip标记),但没有成功。

该功能应该显示菜单项的悬停工具提示,对吗?为什么没有发生?

我正在使用Microsoft Office Professional Plus2013。

以下屏幕截图:有问题的自定义功能区选项卡。尽管我的屏幕截图程序未捕获光标,但第一个菜单项当前在光标下方。即使等待10秒钟,也不会出现这样的工具提示。我尚未能够成功显示工具提示。

Screenshot of Custom Ribbon UI

以下屏幕截图:选项窗口,表明显示功能ScreenTips已被启用。注意:也没有其他(内置)功能显示屏幕提示!有人可以告诉我ScreenTip 应该是什么样吗?如果我的客户端设置启用了这些设置,但没有显示,则可能是该问题的原因? Excel Options ScreenTips Enabled

作为参考,可以找到here的“自定义UI编辑器”按钮的MSDN文档。

1 个答案:

答案 0 :(得分:1)

我已经找到了自己问题的答案!我会分享给后代。

解决方案

问题中的关键信息是:

  

也没有其他(内置)功能显示屏幕提示!

我能够找到ScreenTips的第二个设置(为什么可能有两个不同的设置,意思是“ Show Screentips”,我可能永远不知道)。屏幕截图如下: Screenshot of additional setting

以前,“屏幕提示”样式设置为“不显示屏幕提示”,但应为“在屏幕提示中显示功能描述”。再次,此设置对问题中描述的设置感到多余,但是根据Microsoft的说法,“功能”和“功能”之间可能有所区别...?如果是这样,这些术语(显然)很容易混淆。

无论如何,屏幕提示(和超级提示)现在可以正确显示!请参见下面的屏幕截图: Corrected Settings

反驳性问题

为什么Microsoft有两个标题如此相似的设置?

如果您知道为什么这是两个不同的设置,也许将其作为注释可以帮助进一步解决此问题,或者至少有助于理解术语“功能”和“功能”的含义。