简体   繁体   中英

Access: Reference for Word.Application ActiveX

I am trying to use Windows Automation on my Access (2003 file format) app. I am using the Word.Application datatype. Is there a generic reference I can use that doesn't need a specific version of Word?

You can use late binding.
Instead of declaring something like:

Dim wdApp as Word.Application

use

Dim wdApp as Object

This way you don't need a reference in your VBA project, and versioning won't be so much of a problem (aside from using version-specific functionality). There are a few drawbacks, like loss of intellisense when writing code, and not being able to use built-in constants from the application being automated, but it's more robust when deploying to multiple clients.

See http://www.dicks-clicks.com/excel/olBinding.htm for more details on early vs. late binding (this covers Outlook but same principles apply to Word).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM