+ Reply to Thread
Results 1 to 3 of 3

Runtime Error 5631

Hybrid View

  1. #1
    Registered User
    Join Date
    08-09-2011
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    51

    Runtime Error 5631

    Hi guys

    I am getting the "Runtime error 5631Word could not merge the main document with the data source because the data records were empty or no data records matched your query options." in the following code:

    Public Sub MergeDocs()
     with getobject("J:\System\Sample.doc")
      .mailmerge.execute
      with .application.activedocument
        .PrintOut 
        .Close 0
      end with
      .close 0
     End With
    End Sub

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Runtime Error 5631

    That looks like Word VBA, not Excel
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    08-09-2011
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    51

    Re: Runtime Error 5631

    Hi Roy

    This code is written in Excel vba but it prints off the Word document when the button in the userform is pressed.

    Thanks a lot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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