3
我有一些VBA代码并将其保存为Excel加载项。我需要一种方法来自动安装此Excel加载项。我想创建一个安装程序,以便我的用户可以运行安装程序来安装加载项。使用安装工厂自动安装并启用Excel加载项
我正在关注this guide以自动安装加载项。
但我不明白如何使用安装工厂添加脚本作为指导。例如,如何使用Setup Factory插入此脚本?
--Check whether Excel is opened.
sValues = Window.EnumerateTitles(true);
--Next line has SetupFactory 8 code
--for iCount, sValue in sValues do
for iCount, sValue in pairs(sValues) do
if String.Find(sValue, "Microsoft Excel", 1, true)>0 then
Dialog.Message("Error", "First close Microsoft Excel."..
String.Char(10)..String.Char(10)..
"Uninstaller will now abort.",
MB_OK, MB_ICONINFORMATION);
-- Make sure the process ends with a value other than 0
-- so the uninstall can be performed again.
Application.Exit(EXIT_REASON_USER_ABORTED);
end;
end;
这是一个VSTO加载项或在VBA中创建的加载项?我使用Advanced Installer 9.0来安装我的加载项(特别是在VBA中创建的加载项)。它可以让我为外接程序创建专业的外观设置。如果你不想要这种设置,那么你可以创建和Excel文件,并在Workbook_Open事件中安装外接程序:) –