Results 1 to 2 of 2
  1. #1
    DMT Dave is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    368

    Recordset to Word Document

    Hi Guy's i am trying to output the results of a recordset to a word doc, i haven't put all of the code on because the recordset does return the data by viewing on a msgbox, the error i am getting that there is no document open ? (Run time error 2428 the command is not available because no document is open)

    However, an instance of word is open and minimised to task bar but no document

    I am not wanting to save the output, just grab data then close it



    rsBody is String

    rsBody = rsBody & rs.Fields("Date") & " " & rs.Fields("Name") & vbnewline

    etc

    Set oWord = CreateObject("Word.Application")
    oWord.Visible = True
    oWord.ActiveDocument.Paragraphs(12).Range.Text = rsBody

    Kindest

  2. #2
    Join Date
    Apr 2017
    Posts
    1,147
    Why don't you use Word's Mail Merge with your Access table/query as source, which is designed exactly to do what you are describing?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 06-27-2017, 12:06 PM
  2. Populate a word document with fields from a recordset
    By ItsAlwaysSunny in forum Import/Export Data
    Replies: 1
    Last Post: 07-26-2016, 01:53 PM
  3. Replies: 3
    Last Post: 06-11-2013, 07:21 AM
  4. Create new Word document.
    By Bill H in forum Programming
    Replies: 3
    Last Post: 06-12-2012, 06:40 AM
  5. Import Word document using VBA
    By degras in forum Import/Export Data
    Replies: 4
    Last Post: 04-12-2011, 02:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums - Senior Forums