JBNV123


Hi,

I am trying to set up Word so that I can get information from Excel and input this data into a form letter. I am using Mail Merge and that part works great. But now I want to be able to search for a particular record (recipient) and print the document only for that record.

I know you can search through the "find" button on the mail merge toolbar but I want to make this more user friendly because my fellow emplyees are not very familiar with the mail merge function and it woukld be easier to go through a macro. Is there someway i can do this through VBA Like have the user enter a string into a form with the name of the person they are trying to find and then press a button and have it print


Thanks.

JB




Re: Using VBA in Word to slect and print a particular Record (recipient)

Cringing Dragon


Hi JB,

I guess it's quiet on the forum because it's the weekend.

JBNV123 wrote:
Is there someway i can do this through VBA Like have the user enter a string into a form with the name of the person they are trying to find and then press a button and have it print

The short answer is almost certainly yes and yes.

More clarity on what part of this you want help with would assist us in helping you. Do you want to know how to write the macro, or how to assign a macro to a button

Have you tried recording the manual steps into a macro If you don't know how to do that, then reply to that effect and I'll try to assist. If you have tried that, but it isn't recording everything that you need, or it doesn't play back correctly, then post what you do have, as well as any error it generates.

Also, let us know what version of Office you're using, as that can affect what tools are available to you.

Have fun.







Re: Using VBA in Word to slect and print a particular Record (recipient)

JBNV123

Thanks for the response. I am using Office 2003.

So I tried the record macro and this is what I got:

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 9/24/2007 by UCSF
'
WordBasic.MailMergeFindEntry
End Sub

Basically, I tried to search for a person named "Bob Jenkins" and it did not record my inputting the text into the Find Entry dialog box.

I am linking Mail Merge in Word with an Excel Spreadheet so I can produce form letters with different people's information present in the form letter. Then I want to do something similar to using the Find Entry dialog box to display only "Bob Jenkins" document so I can print only his document without printing any other records. Also I want to do this through a form using VBA.

Is there a way to use VBA to select a single record from the mail merge fucntion I am very familiar with forms so my difficulty is the selection part.

Thanks so much!!






Re: Using VBA in Word to slect and print a particular Record (recipient)

Cringing Dragon

I hoped the recorded macro might show something more useful.

The FindRecord method might do what you need:

ActiveDocument.MailMerge.DataSource.FindRecord(FindText, Field)

For more info, and an example, see the following:

http://msdn2.microsoft.com/en-us/library/aa172022(office.11).aspx

Good luck.






Re: Using VBA in Word to slect and print a particular Record (recipient)

JBNV123

Thank you so much, that helps tremendously. I may have another question soon!!

JB