+ Reply to Thread
Results 1 to 1 of 1

Mail Merge from Excel to word for single row only

  1. #1
    Registered User
    Join Date
    02-28-2014
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Exclamation Mail Merge from Excel to word for single row only

    I have a customer database for a business which I would like to use for a mail merge.

    I have managed to write a macro script which will do a mail merge for every single customer in the database, when a button is clicked on the excel document. I am wanting to set the script so that when the button is clicked, I can choose a single row so that the info on that single row is merged, ignoring all others. I don't mind how this is done, whether it be with a dialog box or by selecting the row and then clicking the merge button (or any other way possible).

    Below is the script i currently have for the full mail merge:

    PHP Code: 
    Sub RunMailMerge()

        
    Dim wdInputName As String
        wdInputName 
    ThisWorkbook.Path "\Referring Practitioner.docx"

        ' open the mail merge layout file
        Dim wdDoc As Object
        Set wdDoc = GetObject(wdInputName, "Word.document")
        wdDoc.Application.Visible = True

        With wdDoc.MailMerge
             .MainDocumentType = wdFormLetters
             .Destination = wdSendToNewDocument
             .SuppressBlankLines = True
             .Execute Pause:=False
        End With

        ' 
    show and save output file
        wdDoc
    .Application.Visible True
        wdDoc
    .Application.ActiveDocument.SaveAs wdOutputName

        
    ' cleanup
        wdDoc.Close SaveChanges:=False
        Set wdDoc = Nothing

    End Sub 
    What do I need to add to the script to allow me to single out rows for the merge, so that I don't get hundreds of merged letters every time I click the button?
    Last edited by proctortom92; 02-28-2014 at 04:02 AM. Reason: needs more info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 01-22-2013, 11:37 AM
  2. Mail merge within Excel...not with Word
    By PattiFlick in forum Excel General
    Replies: 10
    Last Post: 01-05-2013, 03:05 PM
  3. Replies: 2
    Last Post: 11-09-2007, 07:54 AM
  4. need help w/ mail merge excel to word
    By sophia in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 12-20-2006, 01:09 PM
  5. merge with Word How can I get excel to mail merge zip codes plus 4 correctly?
    By Kathy at Sauder Feeds in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-30-2005, 07:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1