簡體   English   中英

Excel VBA 功能區加載項作為第一個選項卡

[英]Excel VBA ribbon add-in as first tab

我按照這篇文章制作了一個自定義功能區插件,

https://www.thespreadsheetguru.com/blog/step-by-step-instructions-create-first-excel-ribbon-vba-addin

它工作得很好,但我可以移動我已成為開始選項卡之后的第二個選項卡的選項卡嗎?

您可以做您想做的事,但這樣做意味着您需要編輯位於 Office 文檔 zip 文件中的 CustomUI.Xml 文件。

如果您在 VBA 中工作,那么 CustomUI 編輯器工具將為您提供最佳服務

https://github.com/OfficeDev/office-custom-ui-editor

此工具將從 Office 文檔中提取 xml 文件,允許您進行編輯,然后將其保存回 Office 文檔。

這是開始閱讀 Ribbon Xml 的好鏈接。

https://www.rondebruin.nl/win/s2/win001.htm

下面的 Xml 來自我的 CustomUI for Word 之一。 我認為它與您要求的相同,因為我將新選項卡插入到功能區主頁選項卡上過去組的左側。 它還用自定義版本替換了段落選項卡。

    <tab 
            idMso="TabHome">

            <group
                id = "Home.RegulatoryCMC"
                label = "Regulatory CMC"
                insertBeforeMso = "GroupClipboard"
                visible="true">

                <button 
                    id = "Home.RegulatoryCMC.StartHere"
                    label = "Start Here"
                    onAction = "RibbonCallbacksForButtons.OnAction"
                    getSupertip = "RibbonCallbacksForSupertips.getSuperTip"/>

                <button
                    id="Home.RegulatoryCMC.ShowStylePane" 
                    label="Show Style Pane" 
                    onAction="RibbonCallbacksForButtons.onAction"
                    getSupertip = "RibbonCallbacksForSupertips.getSuperTip"/>

                <button
                    id="Home.RegulatoryCMC.ResetXML" 
                    label="Reset XML" 
                    onAction="RibbonCallbacksForButtons.onAction"
                    getSupertip = "RibbonCallbacksForSupertips.getSuperTip"/>

            </group>

            <group 
                idMso="GroupParagraph"  
                getVisible="RibbonCallbacksForVisibility.getVisible"/>

                <box 
                    id="Home.Paragraph.Status"
                    boxStyle="horizontal">
                    <buttonGroup 
                        id="Home.Paragraph.Alignment">
                        <toggleButton idMso="AlignLeft"/>
                        <toggleButton idMso="AlignCenter"/>
                        <toggleButton idMso="AlignRight"/>
                        <toggleButton idMso="AlignJustify"/>    
                    </buttonGroup>

                    <buttonGroup 
                        id="Home.Paragraph.Marks"
                        visible="true">
                        <toggleButton idMso="ParagraphMarks"/>
                    </buttonGroup>

                </box>

                <box 
                    id="ParagraphIndent"
                    boxStyle="horizontal">
                    <button idMso="IndentDecreaseWord"/>
                    <button idMso="IndentIncreaseWord"/>
                </box>

                <box 
                    id = "ParagraphOther"
                    boxStyle="horizontal">
                    <gallery idMso="LineSpacingGallery"/>
                    <button idMso="SortDialogClassic"/>
                </box>

                <dialogBoxLauncher>
                    <button idMso="ParagraphDialog"/>
                </dialogBoxLauncher>

            </group>

        </tab>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM