Results 1 to 2 of 2

User Automation to close Word Document and return focus to A

  1. #1
    richardb Guest

    User Automation to close Word Document and return focus to A


    My Access database controls a Mail Merge Job in Word. After generating the
    data, Access opens the Word document with these lines of code in a module:

    Set objWord = GetObject("G:\Access Projects\MyWordDoc.doc", "Word.Document")
    objWord.Application.Visible = True
    objWord.RunAutoMacro wdAutoOpen

    In the Word document the Sub AutoOpen Prints the mail merge job. My AutoOpen
    code ends with ActiveDocument.Close wdDoNotSaveChanges. Unfortunately, I am
    left looking at Word with no open document. I want control returned to the
    Access database form where I was before. Suggestions appreciated. Someone in
    the Word Programming Community referred me here. Thank you.

  2. #2
    Join Date
    Dec 2005
    Posts
    9
    try objWord.Quit

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

Similar Threads

  1. Automation Error
    By aouellette in forum Forms
    Replies: 0
    Last Post: 09-12-2008, 08:00 AM
  2. Replies: 0
    Last Post: 08-25-2008, 12:17 PM
  3. Word document INTO Access form
    By jonathonhicks in forum Forms
    Replies: 0
    Last Post: 04-30-2007, 05:59 PM
  4. Need to set date in query for automation
    By Valeda in forum Queries
    Replies: 0
    Last Post: 06-07-2006, 06:41 AM
  5. access 2003 automation issue
    By BevA in forum Programming
    Replies: 2
    Last Post: 05-01-2006, 08:37 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
  •  
Tech Forums: Microsoft Office Forums