X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Get Data In & Out Of Word With Custom Bound Xml Fields, Access 2007    
post Aug 14 2016, 10:42 AM

Posts: 4,023
Joined: 19-October 10


So for many years I've seen various different ways to try and manage data between Access and Word using bookmarks, mailmerge etc which all have their pro's and cons.
I have just finished developing a totally new method (as far as I know) that uses the customXMLParts that can be added to a word document to create a data table behind the document that can be used to read and write data and can also be bound to content controls in the document to display that information or allow a user to manipulate the data. Data fields can be bound to multiple content controls allowing for a field to be repeated throughout a document if required.

This demo comes in two parts. The first part is a Word template file, this contains various VBA code and a CustomUI used to add data fields to word document and then controls bound to those fields.
It should be very easy to use, it has a script with it that copies the file to the STARTUP folder in Word so that it acts like an addin. The new menu appears on the Insert tab, a screenshot is attached below.
Once data fields have been added to a Word document then the document can be sent to any user and they can enter data into it that we can retrieve later. Alternatively a report template can be designed ready for data to be pushed into it via VBA.
Multiple content controls including picture controls are supported. Further testing is needed on bound picture fields but they could provide an alternative to 'blob' style methods as they are stored as text in the xml table.

The second part is an Excel file which is a simple Demo of how to use a class I designed to manage getting data in and out of a Word document using automation.
The class module can be copied into an Access database and used in the same manner.

Hopefully this can really help when you need to collect data remotely and want to import it into Access or if you want to push data out of Access and into a Word file!

To do:
There is currently no error handling.
See if its possible to read the xml data without opening the Word file?
See if its possible to return a recordset of data rather that manipulating a field at a time.
See if its possible to have a repeating data set in the xml data to facilitate tables of data....
Attached File(s)
Attached File  Screenshot.jpg ( 30.89K )Number of downloads: 1
Attached File  Custom_XML_Fields_in_Word.zip ( 106.62K )Number of downloads: 32
Go to the top of the page

Custom Search

RSSSearch   Top   Lo-Fi    18th January 2019 - 06:32 AM