In order to Automate with Word, there are a couple of things we need to take care of.

References

When manipulating Word from Access, we will need to have access to a library of objects and methods associated with Word. These will need to be referenced in VBA and here is how you do it:

Open up the database.

Screenshot 2014-01-24 09.55.53Press ALT+F11 to open up the VBA editor.

Screenshot 2014-01-24 09.56.02Click on the tools drop down menu and choose References.

Screenshot 2014-01-24 09.56.09Scroll down and find Microsoft Office 15.0 Library (12.0 for 2007, 14.0 for 2010). This library is a generic library that will enable you to use objects such as recordsets. Check the box.

Screenshot 2014-01-24 09.56.28

 Scroll down and select Microsoft Word 15.0 Object Library (12.0 for 2007, 14.0 for 2010). This library will enable you to interact with Word objects and methods. Check the box.

Click OK and the dialog form will close.

Screenshot 2014-01-24 09.56.46Reopen the dialog form and you should see that the Word and Office libraries are checked.

Screenshot 2014-01-24 09.56.55You now have the requisite libraries to enable you to automate Word!

Leave a Reply

Your email address will not be published. Required fields are marked *

Visit Us On TwitterVisit Us On FacebookVisit Us On Youtube