Results 1 to 14 of 14
  1. #1
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Word Automation Errors (2002)

    Hello All Thank you in advance for taking the time to help out. Woody's Lounge is such a valuable resource for me and I am sure many others. It is truly a help.

    OK Here is the problem...

    I am trying to set up a command button on a form that will allow users to click on the button and merge data to create a letter in Word. Here is the code (I am a novice.... I don't know if this is even close... BUT.. I am trying... <img src=/S/dizzy.gif border=0 alt=dizzy width=15 height=15>)

    Private Sub openSHMM_Click()

    Dim oWord As Word.Application
    Set oWord = CreateObject("Word.Applicaton")

    oWord.Visible = True

    oWord.Documents.Open ("FataEB DatabaseMail MergeSafe Harbor MemoSH Notice Memo.doc")

    oWord.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
    oWord.ActiveDocument.MailMerge.Execute Pause = False
    oWord.ActiveDocument.PrintPreview

    Set oWord = Nothing

    End Sub

    Any way when I try and test the button I get an error message that says "Run-Time Error '429' Active X component can't create object'

    ANY HELP????? This word automation thing seems to be harder than I thought... I have looked thru other posts, been to WendellB's Automation 101 and have gone thru many books.... NO LUCK!!!! Any suggestion is welcome!

    Also (just a thought not a necessity) but can Access be set up similar to this to Automate reports to be sent via Groupwise Email?

    Thanks again!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Automation Errors (2002)

    1) Instead of
    <code>
    oWord.ActiveDocument.MailMerge.Execute Pause = False
    </code>
    you should have
    <code>
    oWord.ActiveDocument.MailMerge.Execute Pause:=False
    </code>
    2) Has SH Notice Memo.doc already been set up for mail merge, i.e. a data source has been selected and mail merge fields have been placed in the document?

    3) After editing the code, you *must* close and reopen the database before testing it. By editing the code, you place an exclusive lock on the database, and Word won't be able to connect to it.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Automation Errors (2002)

    About your other question: if GroupWise is the default e-mail program, you should be able to send e-mails using DoCmd.SendObject.

  4. #4
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Ok
    1) I changed the Pause = False to Pause:=False,
    2) Yes I created the Document first, and linked it to the Database, I tested it in Word to make sure it worked which it did.
    3)I closed and re-opened the Database re-clicked the button, it opened the merge document but NEW ERROR THIS TIME
    The debug highlights the line that says "oWord.ActiveDocument.MailMerge.Destination = wdSendToNewDocument")"

  5. #5
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Sorry the error message says "Requested object is not available"

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Automation Errors (2002)

    What happens if you change

    oWord.Documents.Open ("FataEB DatabaseMail MergeSafe Harbor MemoSH Notice Memo.doc")

    oWord.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
    oWord.ActiveDocument.MailMerge.Execute Pause = False
    oWord.ActiveDocument.PrintPreview

    to

    With oWord.Documents.Open ("FataEB DatabaseMail MergeSafe Harbor MemoSH Notice Memo.doc")
    .MailMerge.Execute Pause:=False
    End With

  7. #7
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Well, that would have worked however the problem is that I keep loosing my link to the query. I don't want to have to re-establish the link everytime... Here is what the Error was this time: This method or property is not available because this document is not a mail merge main document. <img src=/S/brickwall.gif border=0 alt=brickwall width=25 height=15>

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Automation Errors (2002)

    Without seeing the database and document it's hard to say what exactly causes the problems. You might try saving the Word document without the link to the data source, and use ...MailMerge.OpenDataSource to establish the data source in runtime - this is my preferred method, since you can specify the query to be used dynamically. If you search for OpenDataSource in this forum, you'll find some examples.

  9. #9
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Thank you Hans, I will persue this and go from there. Your help is alway appriciated!

  10. #10
    3 Star Lounger
    Join Date
    Jun 2001
    Location
    Salem, Oregon, USA
    Posts
    219
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Rachel, you might also take a look at a recent Access Watch newsletter by Helen Feddema, found of of Woody's Lounge Main Portal. The number is "AW #9.09," titled "Mail Merge in Access 2007." It's not specific to 2007, that is, I adapted the idea for my XP. I had already done a couple of merges (thanks to help from Hans, here, about the same ":=" syntax you needed) but found Helen's recommendation to go to a text file to merge to the Word document to be a simpler, more flexible, and less trouble-bound. Check out that article if you have the time, I think you'll find it helpful, even if you don't use any of the code.
    thx
    Pat

  11. #11
    Star Lounger
    Join Date
    May 2003
    Location
    Kansas City, Kansas, USA
    Posts
    76
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Thank you! I will do that... I have one of her books, Access Inside Out and it is a great help as well. I am going to sign up for that newsletter as well... Thanks again!!

  12. #12
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Can anyone tell me how to find the Access Watch Newsletter mentioned in Patricia W's post?

    Thanks in advance for your assistance.

    Ken

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Word Automation Errors (2002)

    The Office Watch website hasn't been kept up-to-date for over two years now. You can probably find the article on Helen Feddema's website - see Access Archon, but I don't know which one Patricia referred to.

  14. #14
    4 Star Lounger
    Join Date
    Jan 2003
    Location
    Central Florida, USA
    Posts
    505
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Word Automation Errors (2002)

    Hans,

    Thanks! I had searched Helen's site with no luck.

    Thanks for getting back to me so quickly.


    Ken

Posting Permissions

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