我可以将RegFree Com与用Excel VBA编写的应用程序一起使用吗? [英] Can I use RegFree Com with an application written in Excel VBA?

查看:69
本文介绍了我可以将RegFree Com与用Excel VBA编写的应用程序一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用Excel VBA编写的应用程序myApp.xls.当前,我们使用InstallShield分发应用程序.由于我们要迁移到Windows Vista,因此我需要能够以标准用户身份安装该应用程序.这不允许我在安装过程中更新注册表.除了excel应用程序外,我们还有几个VB6应用程序.为了安装这些应用程序,我能够按照该论坛上的建议使用RegFree com和Make My Manifest(MMM)(我非常感谢您的见解!).这个过程虽然有些乏味,但效果很好.然后,我将MMM的输出打包在VS '05安装程序项目中,并使用msiinfo.exe删除了msi上的UAC提示符.现在,我面对的是安装基本上驻留在Excel文件中的应用程序.我修改了MMM为我的一个VB6应用程序为我创建的清单,并试图通过该清单运行excel文件,但是运气不佳.有人知道这样做的方法吗?RegFree com是否可以与VBA一起使用?任何想法或建议将不胜感激.

I have an application that is written in Excel VBA, myApp.xls. Currently we use InstallShield to distribute the application. Since we are moving to Windows Vista, I need to be able to install the application as a standard user. This does not allow for me to update the registry during the install process. In addition to the excel application we also have several VB6 applications. In order to install those applications, I was able to use RegFree com and Make My Manifest (MMM) as suggested by people on this forum (I greatly appreciate the insight btw!). This process, although a bit tedious, worked well. I then packaged the output from MMM in a VS '05 installer project and removed the UAC prompt on the msi using msiinfo.exe. Now I am faced with installing an application that basically lives in an Excel file. I modified a manifest that MMM created for me for one of my VB6 apps and tried to run the excel file through that, but I did not have much luck. Does anybody know of a way to do this? Does RegFree com work with VBA? Any thoughts or suggestions would be much appreciated.

谢谢

史蒂夫

推荐答案

是的,可以在Win2k3 +上通过VBA使用免注册COM.

Yes, it is possible to use registration-free COM through VBA, on Win2k3+.

从根本上说,无reg表示该COM类不再需要注册才能被发现,而是由清单来携带注册信息."

Fundamentally, reg-free says "this COM class no longer needs to be registered to be discoverable, instead registration info will be carried by a manifest".

如果将清单嵌入到可执行文件中,则它们本身将被隐式引用,或者命名为* .exe.manifest.但是,对于VBA,您的代码并不存在于您控制的可执行文件中,因此您需要另一种方式来获取对清单的引用.

Manifests themselves are implictly referenced by executables when they are embedded in the executable, or named *.exe.manifest. However, in the case of VBA -- your code doesn't live in an executable you control, so you need another way to get a reference to the manifest.

这就是 Microsoft.Windows.ActCtx 的位置 Microsoft.Windows.ActCtx 对象进来-它特别允许您在给定显式清单引用的情况下实例化您的对象.

That's where the Microsoft.Windows.ActCtx object comes in - it specifically allows you to instantiate your object given an explicit manifest reference.

例如(在JS中,因为我对VBA语法感到生疏):

For example (in JS, since I'm rusty on VBA syntax):

var actCtx = WScript.CreateObject("Microsoft.Windows.ActCtx");
actCtx.Manifest = "myregfree.manifest";
var obj =  actCtx.CreateObject("MyObj");   

这篇关于我可以将RegFree Com与用Excel VBA编写的应用程序一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆