vba VbaProject.OTM 部署

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14460036/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 19:17:14  来源:igfitidea点击:

VbaProject.OTM deployment

vbaoutlookoutlook-addinoutlook-vba

提问by dan

I came by this pageand was thinking about the best method to distribute my VbaProject.OTMfile (located into %appdata%\Microsoft\Outlook\) to a bunch of ~30 users at my office. Is it better to simply copy/paste the OTM file onto the network and then copy/paste it back to all users' computers (manually or with a .bat) ORwould it be better to use the method described in the link above to generate a OPS file and import it back with Proflwiz.exe? What's the difference?

我来到这个页面,正在考虑将我的VbaProject.OTM文件(位于%appdata%\Microsoft\Outlook\)分发给我办公室的大约 30 名用户的最佳方法。简单地将 OTM 文件复制/粘贴到网络上,然后将其复制/粘贴回所有用户的计算机(手动或使用 .bat)是否更好,或者最好使用上面链接中描述的方法来生成一个 OPS 文件并使用 Proflwiz.exe 将其导入?有什么不同?

We are all on Microsoft Office Outlook 2003 actually, we might upgrade to 2007 one day but still years from now.

实际上,我们都在使用 Microsoft Office Outlook 2003,我们可能有一天会升级到 2007,但仍需多年。

回答by dan

Finally came up with some elements to deploy a Outlook VBA Project. There are a lot of ways to do this, but the easiest way to do so without installing anything and keeping the same methodology would be to run a OTM file directly from a server. I found out that the process outlook.exe has a parameter altvbathat allows to specify another path to run the OTM file from. Here is en example:

最后想出了一些元素来部署 Outlook VBA 项目。有很多方法可以做到这一点,但不安装任何东西并保持相同方法的最简单方法是直接从服务器运行 OTM 文件。我发现Outlook.exe进程有一个参数altvba允许指定另一个路径来运行 OTM 文件。这是一个例子:

outlook.exe /altvba "\\myServer\myFolder\myFile.otm"

outlook.exe /altvba "\\myServer\myFolder\myFile.otm"

This allows me to update only one file to get all computers updated. Obviously, if the file is big and the server's ping is on the high side, it may delay the launch of Outlook. The other problem with this method is that everybody will have to shut down Office if you want to update the OTM file on the server (and if you do work in an office where everyone uses Outlook, you do know that it is impossibleto get everyone to shut it down at the same time, except if you code a macro to do so eventually). To prevent both those problems, I could setup a batch file to copy the server OTM file clientside everytime there is a new version (just have to check the NTFS last-modify attribute). This way, Outlook will boot with a local file, the batch file take 2-3 seconds to copy the file if needed (or will launch Outlook instantaneously) and there will be no problem updating the OTM file on the server. Users will have to start Outlook with the batch file (or with the slightly different outlook.exe path with the altvba parameter, so either way they need a different shortcut/file to start off the first time). One other advantage of the altvbais that it's still easy for the user to run Outlook without it (to see if the VBA is problematic or not in case Outlook is sluggish) and the file will remain unchanged after a Outlook reinitialization.

这允许我只更新一个文件来更新所有计算机。显然,如果文件很大,服务器的ping偏高,可能会延迟Outlook的启动。这种方法的另一个问题是,如果你想更新服务器上的 OTM 文件,每个人都必须关闭 Office(如果你在一个每个人都使用 Outlook 的办公室工作,你知道这是不可能的让每个人同时关闭它,除非你编写了一个宏来最终这样做)。为了防止这两个问题,我可以设置一个批处理文件来在每次有新版本时复制服务器 OTM 文件客户端(只需检查 NTFS last-modify 属性)。这样,Outlook 将使用本地文件启动,如果需要,批处理文件需要 2-3 秒来复制文件(或将立即启动 Outlook),并且更新服务器上的 OTM 文件将没有问题。用户必须使用批处理文件启动 Outlook(或使用略有不同的 Outlook.exe 路径和 altvba 参数,因此无论哪种方式,他们都需要不同的快捷方式/文件才能第一次启动)。的另一大优势altvba是用户在没有它的情况下运行 Outlook 仍然很容易(查看 VBA 是否有问题,以防 Outlook 缓慢)并且在 Outlook 重新初始化后文件将保持不变。

Others solutions include a COM complement that can be developed in a lot on languages including VB6 (no conversion needed from VBA). There is also a bunch of tools included into Microsoft Office XP Developer that could help getting the job done (not free however, especially if you need the most up-to-date version).

其他解决方案包括一个 COM 补充,可以在很多语言上开发,包括 VB6(不需要从 VBA 转换)。Microsoft Office XP Developer 中还包含大量工具,可以帮助完成工作(但不是免费的,尤其是在您需要最新版本的情况下)。