添加后如何自动将自定义宏插件添加到 toolbar/ribbon?

How do I automatically add custom Macro Add-in to toolbar/ribbon after adding it in?

如何尽可能快速和简单地添加自定义宏 XLAM 文件?

我有一个保存为 XLAM 文件的宏。我希望我工作的其他非 Excel 精明的人能够下载 XLAM 文件,像使用任何其他加载项(例如求解器)一样添加它,并让它成为一个简单的万无一失的过程.

但是,目前它涉及添加它,然后转到 文件 > 选项 > 自定义功能区 > 宏 > MyFancyMacroAddin。然后单击加载项,然后创建一个新选项卡和子组,我可以将加载项从左列移动到右列。这是一个漫长且容易出错的过程。每当我添加诸如 Solver 之类的东西时,它都会在添加后弹出到我的工具栏中。但是,在执行自定义 XLAM 时,它似乎需要更多步骤。

如有任何意见,我们将不胜感激。

微软Excel功能区

要在 Excel 中创建 create/edit 功能区,请使用 Custom UI Editor Tool。以下是创建 XML:

的一些来源

安装 Excel VBA 加载项

我在他们的机器上使用 XCOPY in a .bat file for installing my .xlam files to user machines. I'll setup a folder on a network share e.g. S:\Addins\MyFancyMacroAddin and put the .xlam and .bat file in it. Then I distribute a shortcut to the .bat file to the end-users. It copies the file from the current directory to the XLSTART 文件夹。

You can click on the animation below to view it a bit easier.

示例:

代码:

@ECHO OFF

REM |--------------------------------------------------------------------------------------------------------------------
REM | Purpose:  Generic Excel Addin Install
REM |--------------------------------------------------------------------------------------------------------------------


REM
REM     /E   = Copies directories and sub-directories, including empty ones. Same as /S /E. May be used to modify /T. 
REM     /D:m-d-y = Copies files changed on or after the specified date. 
REM        If no date is given, copies only those files whose source time is newer than the destination time. 
REM     /K   = Copies attributes. Normal Xcopy will reset read-only attributes. 
REM     /Q   = Does not display file names while copying. 
REM     /R   = Overwrites read-only files. 
REM     /Y   = Suppresses prompting to confirm you want to overwrite an existing destination file. 
REM

REM Copy the install directory and sub-directories
REM echo f | XCOPY ".\MyFancyMacroAddin.xlam" "%AppData%\Microsoft\AddIns\MyFancyMacroAddin.xlam" /E /K /Q /R /Y /D
    echo f | XCOPY ".\MyFancyMacroAddin.xlam" "%AppData%\Microsoft\Excel\XLSTART\MyFancyMacroAddin.xlam" /E /K /Q /R /Y /D
REM echo f | XCOPY ".\MyFancyMacroAddin.xlam" "%AppData%\Roaming\Microsoft\Excel\XLSTART\MyFancyMacroAddin.xlam" /E /K /Q /R /Y /D