更新 Excel 加载项的过程?
我在我们的一个部门部署了一个 Excel 2003 加载项,偶尔需要更新。 目前发生的情况是,我将新版本从我的计算机发布到中央位置,这会更新存储在数据库中的版本号,每次运行其中的任何模块时,加载项都会检查该版本号,如果更新的版本号找到后,加载项将停止,并显示一条消息,通知用户需要更新加载项。
目前,他们需要使用更改加载项的 workbook_open
事件来运行另一个工作簿。
我想要的是加载项检测到有新版本可用,并在继续用户操作之前静默安装它。 问题是,卸载现有版本的第一步会失败,因为卸载加载项后,加载项中的任何代码都会立即完成。
我会在用户的 individual.xls 中即时创建一些代码来处理转换,但我无法在用户的计算机中设置“信任对 Visual basic 项目的访问”标志,因此无法在加入。
我从这里看到的唯一方法是有两个加载项,一个处理更新,另一个实际执行工作。 当我不可避免地必须更新更新加载项时,问题就来了!
其他人可以提出更好的解决方案吗? 这必须是 100% Excel,没有 VSTO 等。
I have an Excel 2003 add-in deployed in one of our departments that occasionally needs updated. What currently happens is that I publish the new version from my machine to a central location, this updates a version number stored in a database that the add-in checks each time any of the modules within it are run, and if a newer version number is found then the add-in halts with a message informing the user that they need to update the add-in.
This currently involves them running another workbook with a workbook_open
event that changes the add-in.
What I'd like to have is the add-in detect that a newer version is available and silently install it before carrying on with the user's operation. The problem is that this fails on the first step of uninstalling the existing version because any code in the add-in immediately finishes when the add-in in uninstalled.
I would create some code in the user's personal.xls on-the-fly to handle the changeover but I am unable to set the 'Trust access to Visual basic project' flag in the users' machines so can't have replicating code in the add-in.
The only way I can see from here is to have two add-ins, one that handles the updates and one that actually does the work. The problem comes when I inevitably have to update the update add-in!
Can anyone else suggest a better solution? This must be 100% Excel, no VSTO etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我尝试了不同的方法,步骤如下:
1.编写一个插件并将其放在共享驱动器空间上
2.将项目添加到VBA引用中
3. Excel 工作表中使用的函数和宏添加为对插件的引用
每次加载 Excel 工作表时,新的插件和引用都会刷新。
由于网络不在线时出现问题,我更改了更新按钮的解决方案。
I tried something different, step as following:
1. write an addin and put it on shared drive space
2. add the project to VBA references
3. your functions and macros used in excel sheets add as references to addins
every time excel sheet loads, new addin and references refreshes.
i chabge the solution to update button, because of problems when network is not online.
因为我在任何地方都找不到“工作流程”,所以我将发布昨天处理几乎相同问题时的经验。 (无自动更新)
在 @Lunatik 的 dilydoseofexcel.com 链接中,Charles 发布了他的插件(可从 下载http://www.decisionmodels.com/downloads.htm#addload)这解决了我的情况。
先决条件
任何想要使用远程服务器上的插件的用户都必须添加
AddLoaderV2.xla
插件。从 Excel:
开发人员选项卡 - Excel 加载项 - 浏览 - ...\AddLoaderV2.xla - 当要求将其复制到本地时选择“否”
结构
注意:文件夹的前缀
USER
只是我的偏好,因为我为很多人维护插件。我的工作流程(更新插件)
FinancialFunctions_v0.0.2.xlam
时,我会制作一个副本(因为 v0.0.2 被很多人使用):dev_FinanctialFunction_v0.0.3.xlam
code>v0.0.3
并进行所需的更改FinanctialFunctions_v0.0.3.xlam
自动
加载(在AddinLoad.txt
中定义)v0.0.3
Addins
选项卡中,有: https:// /i.sstatic.net/BULMD.png 因此用户只需选择插件即可重新加载闭包
我想从你的插件中进行一些自动化工作不会是很多工作“检查是否有新版本可用,如果有,则调用
AddLoaderV2
插件的reload
函数。”希望这对某人有帮助。 我最大的问题是理解
.xlam
文件和AddinLoad.txt
根名称的命名,以始终仅加载最新版本。 当你下载他的插件时,有一个 3 页的自述文件。查尔斯来救援! 祝你有美好的一天。
现在我必须找到类似加载 PowerPoint 插件的东西......
Because I didn't find the 'workflow' anywhere I'll post my experience from yesterday when I dealt with almost the same problem. (No automatic updates)
In the @Lunatik's link to dilydoseofexcel.com, Charles posted his Addin (downloadable from http://www.decisionmodels.com/downloads.htm#addload) which resolved my situation.
Prerequisites
Any user that wants to use plugins that are on the remote server has to add the
AddLoaderV2.xla
addin.From Excel:
Developer Tab - Excel Add-ins - Browse - ...\AddLoaderV2.xla - select 'NO' when asked to copy it locally
Structures
Note: The prefix
USER
of the folder is just my preference I because maintain addins for a big number of people.My Workflow (updating Addin)
FinancialFunctions_v0.0.2.xlam
, I make a copy (because v0.0.2 is used by many people):dev_FinanctialFunction_v0.0.3.xlam
v0.0.3
and make needed changesFinanctialFunctions_v0.0.3.xlam
auto
load (defined withinAddinLoad.txt
) thev0.0.3
Addins
Tab, there is: https://i.sstatic.net/BULMD.png so the user just select the Addin to reloadClosure
I imagine it won't be a lot of work to do some automatization from your Addin like "check if new version is available, if yes, call the
reload
function of theAddLoaderV2
Addin."Hope this helps someone. My biggest problem was understanding the naming of the
.xlam
files andAddinLoad.txt
root name to always load only the newest version. There is a 3-page readme when you download his Addin.Charles to the rescue! Have a great day.
Now I have to find something similar to load PowerPoint addins...
我们使用一个单独的插件作为引导程序。
很复杂,但是有效。
We use a separate addin as a bootstrapper.
Complicated, but it works.
Dick Kusleika 今天发表了有关管理加载项的博客,真是太好了!
http://www.dailydoseofexcel.com /archives/2009/07/29/conditionally-load-excel-add-ins/
一些好的建议可以应用于我的情况。
It was nice of Dick Kusleika to blog about managing add-ins today!
http://www.dailydoseofexcel.com/archives/2009/07/29/conditionally-load-excel-add-ins/
Some good suggestions that can be applied to my situation there.
尽管不久前,我实现了类似的一种方法如下:
在公共页面上提供一个名为“更新”的按钮(可能是一个公共文件,如果您使用很多),当用户单击该按钮时,它会在网络位置并将代码从该文件复制到本地文件并关闭新打开的文件。
这样,每当我有更新时,我都会发送一封电子邮件,要求他们在本地更新代码。
它之所以有效,是因为我的用户很少,而且更新的数量也很少。 如果您想要自动更新,什么会阻止您在每次打开文件时检查版本号。
One way I achieved something similar, albeit, a while ago is as follows:
Provide a button called Update on a common page (may be a common file, if you are using many) and when users click that, it opens a xls in a network location and copies the code from that file to the local file and closes the newly opened files.
That way, whenever I had an update, I would send an email asking them to update code locally.
It worked as I had few users and updates were fairly few in number. If you want an auto update, what prevents you from checking the version number during each and every opening of the file.
使用开箱即用的 ClickOnce 部署,只要使用加载项的应用程序 (Excel) 启动,就会检查加载项版本。 不确定是否可以通过这种方式部署非托管代码。
Using out of the box ClickOnce deployment, the add-in version is checked whenever the app using it (Excel) starts. Not sure if you can deploy non-managed code in this way.