exe中的VBA引用

发布于 2024-10-06 14:09:17 字数 306 浏览 7 评论 0原文

我最近制作了一个 Excel 工具,它大量使用了 VBA 宏。 该工具在我的电脑和我大多数同事的电脑上完美运行,但我注意到它在其他一些电脑上不起作用。这是因为这些电脑上不存在一些所需的参考文件。

我想通过制作原始 Excel 文档的 exe 文件来解决这个问题,其中包含所有引用的文件。我已经用 Winrar 尝试过此操作,但我注意到,解压 exe 后,参考文件解压到复制 exe 文件的文件夹中,而不是解压到所需的系统文件夹中。

我该如何解决这个问题,以便我可以在我想要的任何计算机上使用该工具?

提前致谢!

亲切的问候, 马克

I recently made an Excel-tool, which makes heavy use of VBA macros.
This tool works perfectly on my pc, and on most of my colleagues pc's, but I noticed that it doesn't work on some other pc's. This is because some of the required reference files are not present on those pc's.

I would like to solve this by making an exe-file of the original Excel document, in which all the referenced files are included. I already tried this with Winrar, but I noticed that, after unpacking the exe, the reference files are unpacked in the folder in which the exe file was copied, but not in the required system folders.

How can I fix this, so that I can use the tool on whichever computer I'd like to?

Thanks in advance!

Kind regards,
Marc

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(3

百思不得你姐 2024-10-13 14:09:17

Michael Todd 关于许可的评论值得检查,但假设没问题,您可以编写一个简单的批处理文件和/或脚本来首先解压缩文件,然后将它们复制到相关目录中。该脚本最好在安装 Excel 文档期间执行。

但是,根据它们是什么文件,我会谨慎地将它们复制到系统目录中。首先,您有权限写入这些目录吗?其次,您是否有可能覆盖这些 dll 的其他版本,可能会用旧版本覆盖新版本。根据您尝试复制的 DLL,您可能会通过复制它们来破坏其他应用程序甚至 Windows 本身。

一般来说,如果问题的解决方案是将随机 DLL 从您的计算机复制到其他人的计算机,您应该查看寻求替代解决方案。我建议更好的解决方案可能是将您的应用程序更改为不引用这些 dll,或者如果无法做到这一点,请在出现问题的计算机上正确安装这些 dll 所在的应用程序。

Michael Todd's comment about licensing is something worth checking up, but assuming that's ok, you could just write a simple batch file and/or script to first unrar the files and then copy them into the relevant directories. This script would preferably be executed during installation of your excel document.

However, depending on what files they are I'd would be wary of copying them into system directories. Firstly, will you have permissions to write to those directories? Secondly, is it possible that you'll overwrite other versions of those dlls, possibly overwriting a newer version with an older version. Depending on what DLLs you're trying to copy, you might break other applications or even Windows itself by copying them in.

In general, if the solution to your problem is to copy random dlls from your machine to someone else's machine, you should look for an alternative solution. I'd suggest that the better solution might be to change your application to not reference those dlls, or if that can't be done, do a proper install of the application where those dlls come from on the machines where you have the problem .

入画浅相思 2024-10-13 14:09:17

可以肯定的是:

Winrar 显示如下内容:

alt text

并且您应该选择“存储完整路径”(更好) )或“存储包括驱动器号的完整路径”(更糟糕)


Just to be sure:

Winrar shows something like this:

alt text

and you should be selecting either "Store full paths" (better) or "Store full paths including drive letter" (worse)

晨曦÷微暖 2024-10-13 14:09:17

我强烈建议您尝试 Inno Setup。它具有较高的初始学习曲线,但由于其比 WinRAR 增强的功能(对于此类事物),它是非常值得的。 Inno-Setup 从纯文本安装文件创建安装程序,但是“快速启动包”包含一个 GUI 前端,使这部分变得更容易。

I highly recommend you try Inno Setup. It has a higher initial learning curve, but it is well worth it for the enhanced functionality over WinRAR (for this type of thing). Inno-Setup creates installers from plain-text setup files, however, the "Quick Start Pack" includes a GUI front-end for making this part easier.

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