[AccessD] Word Automation

Henry Simpson hsimpson88 at hotmail.com
Tue Mar 11 15:47:00 CST 2003


If you invest a significant amount of work in Word, you will find that an 
Automation session of Word run by Access can iterate the bookmarks 
collection of the document object.  I have given the users a list of 
bookmark names that they can use in any document.  If they save that 
document as a template in a particular folder, that template file will 
appear in a callback filled combo of documents that may be created from a 
record or query.  Double click of any template file in the combo will create 
a new Word doc based on the template for the record or each record in a 
query should that source be selected.

For versatility with things like date datatypes, users have been trained to 
use a bookmark named DocDate for 'March 11, 2003' or DocDate_dd_mmm for '11 
Mar'.  Since bookmarks can not contain punctuation, should punctuation be 
required, the Date must be broken down into components with the punctuation 
between bookmarks.  If the suffix of any bookmark containing a parsable 
format string ends in 'ord' and begins with 'DocDate', then the appropriate 
th, rd or nd suffix is appended in Word.  Should the document require the 
current month or the month of a project start date or an invoice date or 
whatever, in several places, the bookmark name cannot be repeated.  In that 
case, the users Prefix the bookmark with DocDate1, DocDate2 and so on.

For things like this, all that happens is that the application iterates and 
parses each bookmark name and selects the appropriate field and format to 
write to Word.  Should the field parsed data type happen to be currency, a 
formatCurrency function is called that formats the data to a currency 
string.

Users may now point any query at any document in their custom templates 
folder and Access will generate a series of documents.  What's more, the 
users need only be able to set parameters from a multi field filter 
interface and not only is the query customized accordingly, related records 
are pulled even though they may not be required by the document.  The price 
of flexibility is a bit of overhead in the queries as a Project record may 
have related invoice data when all that is needed is PO information.

Not one of the users I deal with knows how to generate a merge, never mind a 
query, but they can select a record from a combo and punch a button.  And 
now, they can even use the insert menu from Word and insert one of about 200 
allowed bookmark names.  They have even figured out how to save the file in 
their custom template folder.  The biggest training hurdle was to get them 
to add a suffix to a field name of the bookmark should it be required in 
more than one place in the document.

Although considerable effort and thought went into the original system, it 
is now virtually maintenance free and I am rarely called in for minor 
changes to existing document templates or even entirely new documents.


Hen

>From: Brett Barabash <BBarabash at tappeconstruction.com>
>Reply-To: accessd at databaseadvisors.com
>To: "'accessd at databaseadvisors.com'" <accessd at databaseadvisors.com>
>Subject: RE: [AccessD] Word Automation
>Date: Tue, 11 Mar 2003 14:41:35 -0600
>
>I've seen this discussed before on this list, and wondered why people are
>rolling their own mail merge routines?  Personally, I find bookmarks
>cumbersome to work with and mail merge has always worked well for me with
>minimal effort.
>
>
>-----Original Message-----
>From: John Bartow [mailto:jbartow at earthlink.net]
>Sent: Tuesday, March 11, 2003 10:38 AM
>To: AccessD
>Subject: [AccessD] Word Automation
>
>
>Bryan (or any other word gurus out there),
>Can you think of a way to elegantly replace my (word automation) mail 
>merges
>with your bookmark style automation?
>
>Basically use bokmarks and some looping scheme to dump addresses it a
>prepared letter/envelope, creating one document with all of the merged
>letters/envelopes.
>
>JB
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com


_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus




More information about the AccessD mailing list