如何使添加自定义Macro XLAM文件的过程变得尽可能快速和简单?
我有一个宏另存为XLAM文件。我希望我工作的其他非Excel熟练人员能够下载XLAM文件,像使用其他任何外接程序(例如Solver)一样添加XLAM文件,并使它成为一个简单的防呆过程。
但是,当前涉及到将其添加到其中,然后转到文件>选项>自定义功能区>宏> MyFancyMacroAddin 。然后单击加载项,然后创建一个新的选项卡和子组,可以将加载项从左列移动到右列。这是一个漫长且容易出错的过程。每当我添加诸如Solver之类的东西时,添加后它就会弹出我的工具栏中。但是,执行自定义XLAM时,它需要执行更多步骤。
任何输入将不胜感激。
答案 0 :(得分:4)
要在Excel中创建创建/编辑功能区,请使用Custom UI Editor Tool。以下是创建XML的一些来源:
我在.bat文件中使用XCOPY将我的.xlam文件安装到用户计算机上。我将在网络共享上设置一个文件夹,例如S:\Addins\MyFancyMacroAddin
并将.xlam和.bat文件放入其中。然后,我将.bat文件的快捷方式分发给最终用户。它将文件从当前目录复制到其计算机上的XLSTART文件夹中。
您可以单击下面的动画来查看它。
@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