Reputation: 2308
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?
Upvotes: 1
Views: 896
Reputation: 166126
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).
Upvotes: 4