Hi Swerv,
The code is mostly a series of wildcard Find/Replace operations on your data file to re-arrange the data into a series of paragraphs for insertion into the invoice file. If you comment-out the '.Close SaveChanges:=False' line, you'll be able to see exactly what it does to the data file in preparation for the insertion. The last part of the code simply tells Word where to put in paragraph from the data file into the Invoice file, using table cell addresses.
The coding is all done by hand. A recorded macro could replicate the Find/Replace part (and possibly even the transfer part), but it would be fairly verbose (full of redundant code), would create lots of screen flicker and run much slower. It also couldn't do the file selection process. The trick with the Find/Replace part, of course, is in knowing how you can use wildcards to re-arrange the data the way you want them ...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
|