Results 1 to 2 of 2

Automating Mail Merge with Macro

Threaded View

  1. #1
    Registered User
    Join Date
    04-05-2016
    Location
    Philadelphia, Pennsylvania
    MS-Off Ver
    Microsoft Office Professional Plus 2013
    Posts
    40

    Automating Mail Merge with Macro

    Hi All,

    I have a mail merge set up between an excel doc and a word doc. I would like to use the excel info to populate the word document, but want to be able to select which row to populate it with. I have the mail merge set up, and I have a macro written to create an Input Box asking for a Booking Number which will then pull over the relevant info. It works, but only for the first row of the excel document and I'm not sure why that is. Below is the macro I presently have written


    Sub invoice()
    Dim dsMain As MailMergeDataSource
    Dim numRecord As Integer
    Dim myBooking As String
    
    myBooking = InputBox("Enter the value:")
    
    ActiveDocument.MailMerge.ViewMailMergeFieldCodes = False
         
    
    Set dsMain = ActiveDocument.MailMerge.DataSource
    If dsMain.FindRecord(FindText:="myBooking", Field:="BookingNo") = True Then
        numRecord = dsMain.ActiveRecord
       
        
        End If
        
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 11-15-2018, 10:54 PM
  2. Mail Merge - Merge fields lister macro
    By adil.master in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2015, 10:33 AM
  3. Replies: 0
    Last Post: 01-05-2015, 07:35 AM
  4. Automating Mail Merge with VBA
    By linuxgeek in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-12-2014, 03:30 PM
  5. Replies: 2
    Last Post: 07-12-2012, 08:11 PM
  6. Macro to run mail merge?
    By carlosbourn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2008, 08:41 AM
  7. Error - automating mail merge through word
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-29-2007, 03:46 PM

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