简体   繁体   中英

Import MS Word Form Field to Access - Missing Reference?

I am trying to import data into access 2007 from a MS Word form field.
I have followed the tutorial here: http://msdn.microsoft.com/en-us/library/aa155434(v=office.10).aspx

When I run the VBA code I get a compile error that says " User-defined type not defined ". After doing some research I've found that it is likely because I am missing a reference to an object in an object library.
I have the following object libraries referenced:

  1. Visual Basic For Applications
  2. Microsoft Access 12.0 Object Library
  3. Ole Automation
  4. Microsoft Office 12.0 database engine Object library
  5. Microsoft Word 12.0 Object library

The error is thrown when the sub is called here:

Sub GetWordData()

Am I missing a reference, or do I have another problem?

Thanks in advance

Ensure that you have set a reference to the Microsoft ActiveX Data Objects xx Library .

In the code window, choose Tools->References, scroll to the library and tick it.

Note that using library references, rather than late binding ( Create.Object("Word.Application") ), makes it easier to access properties and methods but can mean that your code will not run in other environments.

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