跨MS Office应用程序共享VBA模块 [英] Sharing VBA modules across MS Office Applications

查看:104
本文介绍了跨MS Office应用程序共享VBA模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大量用Excel 2010加载项编写的VBA模块.其中一些特定于Excel,但更通用.例如,拿一个零件号并重新格式化.另一个包含案例选择"功能,用于在网络驱动器中查找文件.

I have a substantial bank of VBA modules written in an Excel 2010 add-in. Some of these are specific to Excel, but many are more general. For example one takes a part number and re-formats it; another contains a Case Select function to find a file in a network drive.

我想在Word和Outlook中使用常用功能.我可以将其从Excel复制并粘贴到Word加载项,但这使我的代码保持最新状态很困难-在一个应用程序中进行编辑时,我必须记住要复制到所有其他应用程序.

I want to use the common functions in Word and Outlook. I could copy and paste from the Excel to Word add-ins, but this makes it difficult to keep my code up to date - when I make an edit in one application, I must remember to copy to all the others.

我的问题是,是否有任何方法可以在一个地方(例如,在Excel加载项或某个其他公共位置)编写通用代码,以便所有MS Office应用程序都可以按原样访问它(如果只是另一个模块)?

My question is, is there any means of writing common code in one place (e.g. in the Excel add-in, or some other common location) so that all MS Office applications can access it as it if it's just another module?

推荐答案

此方法过去通常是使用Visual Basic 6来获取您的代码并将其编译为COM(或ActiveX)DLL.然后,您可以添加该代码使用VBA编辑器的工具...参考"对话框,从任何支持VBA的Office(或其他)产品中获得DLL,就像您使用Microsoft Scripting Runtime一样,它对于DictionaryFileSystemObjectTextStream.

The way this used to be done was to take your code and compile it into a COM (or ActiveX) DLL using Visual Basic 6. Then you could add that DLL, using the VBA editor's "Tools...References" dialog, from any Office (or other) product that supported VBA, the same way you might use, say, the Microsoft Scripting Runtime, which is super-handy for things like Dictionary, FileSystemObject and TextStream.

问题是,VB6于1998年某个时候发布,多年来一直没有Microsoft提供或得到Microsoft的支持.似乎有很多下载站点提供该软件包-对于使用它们可能遇到的合法性或安全性问题,我无法提供任何建议...

Problem is, VB6 was released sometime in 1998 and has not been available from or supported by Microsoft for years now. There seem to be quite a few download sites offering the package - I can't offer any advice about the legality or security issues that might be experienced by using them...

可耻的是,微软几年前放弃了VBA球-似乎他们大多希望它能走了.

Shamefully, Microsoft dropped the VBA ball years ago - it seems they mostly wish it would just Go Away.

这篇关于跨MS Office应用程序共享VBA模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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