更新 Excel 加载项的过程?

发布于 2024-07-29 11:21:52 字数 539 浏览 3 评论 0原文

我在我们的一个部门部署了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

轻拂→两袖风尘 2024-08-05 11:21:54

我尝试了不同的方法,步骤如下:
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.

唠甜嗑 2024-08-05 11:21:54

因为我在任何地方都找不到“工作流程”,所以我将发布昨天处理几乎相同问题时的经验。 (无自动更新)

在 @Lunatik 的 dilydoseofexcel.com 链接中,Charles 发布了他的插件(可从 下载http://www.decisionmodels.com/downloads.htm#addload)这解决了我的情况。

先决条件

任何想要使用远程服务器上的插件的用户都必须添加 AddLoaderV2.xla 插件。

从 Excel:开发人员选项卡 - Excel 加载项 - 浏览 - ...\AddLoaderV2.xla - 当要求将其复制到本地时选择“否”

结构

  • 服务器端文件夹结构
T:\my\remote\folder\SOFTWARE\MSOFFICE\Excel_Add-ins
.
├── AddinLoad.txt
├── AddLoaderV2.xla
└── USER_SonGokussj4
    ├── FinancialFunctions_v0.0.1.xlam
    ├── FinancialFunctions_v0.0.2.xlam
    └── dev_FinancialFunctions_v0.0.3.xlam
  • AddinLoad.txt 内容
FinancialFunctions, auto, T:\my\remote\folder\SOFTWARE\MSOFFICE\Excel_Add-ins\USER_SonGokussj4\

注意:文件夹的前缀 USER 只是我的偏好,因为我为很多人维护插件。

我的工作流程(更新插件)

  • 当我想要更新 FinancialFunctions_v0.0.2.xlam 时,我会制作一个副本(因为 v0.0.2 被很多人使用):dev_FinanctialFunction_v0.0.3.xlam code>
  • 我打开 v0.0.3 并进行所需的更改
  • 完成后,我将其重命名为 FinanctialFunctions_v0.0.3.xlam
  • 我向我的部门发送电子邮件,新版本可用
  • 现在,每个新打开的 Excel 都会自动加载(在 AddinLoad.txt 中定义)v0.0.3
  • (如果用户不这样做)不想关闭 Excel,在 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

  • Server side folder structure
T:\my\remote\folder\SOFTWARE\MSOFFICE\Excel_Add-ins
.
├── AddinLoad.txt
├── AddLoaderV2.xla
└── USER_SonGokussj4
    ├── FinancialFunctions_v0.0.1.xlam
    ├── FinancialFunctions_v0.0.2.xlam
    └── dev_FinancialFunctions_v0.0.3.xlam
  • AddinLoad.txt contents
FinancialFunctions, auto, T:\my\remote\folder\SOFTWARE\MSOFFICE\Excel_Add-ins\USER_SonGokussj4\

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)

  • When I want to update FinancialFunctions_v0.0.2.xlam, I make a copy (because v0.0.2 is used by many people): dev_FinanctialFunction_v0.0.3.xlam
  • I open the v0.0.3 and make needed changes
  • When I'm done, I rename it to FinanctialFunctions_v0.0.3.xlam
  • I send an e-mail to my department, that new version is available
  • Now every new opened Excel will auto load (defined within AddinLoad.txt) the v0.0.3
  • If user don't want to close their Excel, in Addins Tab, there is: https://i.sstatic.net/BULMD.png so the user just select the Addin to reload

Closure

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 the AddLoaderV2 Addin."

Hope this helps someone. My biggest problem was understanding the naming of the .xlam files and AddinLoad.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...

够运 2024-08-05 11:21:53

我们使用一个单独的插件作为引导程序。

  1. 主插件可以更新引导程序
  2. 如果主插件需要更新,它会加载引导程序,然后使用 OnTime 调用来安排对引导程序中引导程序例程的调用,并立即卸载自身。
  3. ontime 调用执行。
  4. 引导程序加载主插件,重新启动主插件,卸载自身。

很复杂,但是有效。

We use a separate addin as a bootstrapper.

  1. The main addin can update the bootstrapper
  2. If the main addin needs an update, it loads the bootstapper, then uses an OnTime call to schedule a call to the bootstrap routine in the bootstrap and immediately unloads itself.
  3. The ontime call executes.
  4. bootstrapper loads main addin, relaunches main addin, unloads itself.

Complicated, but it works.

指尖微凉心微凉 2024-08-05 11:21:53

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.

影子的影子 2024-08-05 11:21:53

尽管不久前,我实现了类似的一种方法如下:

在公共页面上提供一个名为“更新”的按钮(可能是一个公共文件,如果您使用很多),当用户单击该按钮时,它会在网络位置并将代码从该文件复制到本地文件并关闭新打开的文件。

这样,每当我有更新时,我都会发送一封电子邮件,要求他们在本地更新代码。

它之所以有效,是因为我的用户很少,而且更新的数量也很少。 如果您想要自动更新,什么会阻止您在每次打开文件时检查版本号。

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.

盛夏尉蓝 2024-08-05 11:21:53

使用开箱即用的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文