Find and Replace with VBA

P

Pam

I am using VB 6 and Word 2002 and need to do a find and replace after a mail merge is done through the vb code. The purpose is to put the date in the merged document that the user has type in the input box. I have tried examples from several books, Microsoft knowledge base and this new group and get errors through the code. Can someone give me the code to do this

Another way I had thought of was to use a fillin box in the word document itself for the user to type the date. However, it displays the box twice...once with the document is added in the code and then when the execute is done. Is there a way to use this option but prevent the box from showing up once. I did select "prompt before merging bookmark text" and it doesn't give it to me for each record but twice at the beginning before the merge starts

I would appreciate any help.
 
J

Jezebel

Easier method is to use a CustomDocumentProperty. Put DocProperty fields in
the master document where you need this date to display, and use File >
Properties > Custom to set the value.


Pam said:
I am using VB 6 and Word 2002 and need to do a find and replace after a
mail merge is done through the vb code. The purpose is to put the date in
the merged document that the user has type in the input box. I have tried
examples from several books, Microsoft knowledge base and this new group and
get errors through the code. Can someone give me the code to do this?
Another way I had thought of was to use a fillin box in the word document
itself for the user to type the date. However, it displays the box
twice...once with the document is added in the code and then when the
execute is done. Is there a way to use this option but prevent the box from
showing up once. I did select "prompt before merging bookmark text" and it
doesn't give it to me for each record but twice at the beginning before the
merge starts.
 
P

Pam

To me this is not easier and am not sure it would put the date on each merged page. The final merged document is being produced through VB code. The user doesn't see anything until the final document is displayed on her screen and it is letters to multiple people so the date needs to be on each page. The user needs to be able to type the desired date through one input box that will then appear on each page of the merged document. Is there a way to do this through VBA?
 
J

Jezebel

I'm assuming that the basic mailmerge is based on a set of mailmerge fields.
Add to that set a DocProperty field. Your VBA code then has to get the value
from the user and set the document property. You could use an input box or a
userform, depending on how much work you want to do and how sophisticated
the interface needs to be.


Pam said:
To me this is not easier and am not sure it would put the date on each
merged page. The final merged document is being produced through VB code.
The user doesn't see anything until the final document is displayed on her
screen and it is letters to multiple people so the date needs to be on each
page. The user needs to be able to type the desired date through one input
box that will then appear on each page of the merged document. Is there a
way to do this through VBA?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top