dbTalk Databases Forums  

Copy and Paste header into MSWord template

comp.databases.ms-access comp.databases.ms-access


Discuss Copy and Paste header into MSWord template in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
dixie
 
Posts: n/a

Default Copy and Paste header into MSWord template - 12-18-2004 , 09:57 PM






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
document?

Any suggestions please.

dixie



Reply With Quote
  #2  
Old   
pietlinden@hotmail.com
 
Posts: n/a

Default 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


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.