Re: Copy and Paste header into MSWord template -
12-18-2004
, 10:32 PM
Hmm... Doesn't sound like an Access question, really, but what the
hey... Basic steps:
0. open the doc containing the correct header
copy the contents of the header to the clipboard or a variable.
1. open each document (say in a directory or whatever)... use Dir() to
get the list into an array, and then walk the array.
2. open the header in each doc. select all. Delete.
3. paste in info from clipboard/string.
4. save & close file
5. go to next.
This is some stuff that Word recorded.... You could probably turn this
into a Function, and then it would just write all the stuff to the
variable (I think... but not very hard!). then you could just loop
through the documents you wanted to copy this to and just
open file, view header, select all, delete, set header value equal to
contents of clipboard.
My guess is that you could probably record most of it in Word using a
macro and then just do a few substitutions and save it into your Access
DB... then you could just reference the Word library and go from
there.
As for pasting from the clipboard memory on the fly, I'd check with
Randy Birch... or the MS site... (Randy doesn't seem to have it... but
then I'm prolly not searching right!)
I'm not totally sure, but I *think* you could assign the text chunk to
a string variable in your code and just do it that way...
I think if you did something like
strMyHeader = Selection.WholeStory
in the original document and then
Selection.WholeStory = strMyHeader
in all subsequent docs, you'd be there...
HTH,
Pieter |