By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,192 Members | 1,253 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,192 IT Pros & Developers. It's quick & easy.

Copy and Paste header into MSWord template

P: n/a
I am doing a job where I need to copy a letter header into each of about 100
letters which are mail merge template documents for about 20 different
customers - all up about 2000 copy and pastes requiring opening each
document and deleting the current header and pasting the new one. I have
tried to use IncludeText to do this and having the header in a file, but it
appears that the client must open each letter and refresh the link before
they can get the header in the letter.

Is there a way of doing what I am trying to do without me doing this
mindless copy and paste operation which takes about 1 hour for each client
and is totally boring and therefore prone to me making mistakes.

Can a simple little program or procedure in Access be written that will take
a lump of text out of one document and just paste it into a series of
documents or even paste the contents of the clipboard into the top of a

Any suggestions please.

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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

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...


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.