VB script error #450 in Word

Posted on 2004-11-12
Last Modified: 2012-08-13
Hello All,
I use this bit of code to send an email by pressing a button on a form in
Private Sub Button91_Click()
   ActiveWorkbook.SendMail Recipients:="**********"
   MsgBox "Your meter read was sent", vbInformation, "****Meter Reads"
But When I try to use the same code in a Word document...
Private Sub Button91_Click()

   ActiveDocument.SendMail Recipients:="************"
   MsgBox "Your meter read was sent", vbInformation, "*****Meter Reads"
 End Sub

I get an error msg. "Wrong number of arguments or invalid property
assignment (Error 450)"

What am I doing wrong??

Question by:BadRastaMan
    1 Comment
    LVL 27

    Accepted Solution

    Word SendMail method is different then excel's one - it intend not for sending email but for showing send mail dialog, so it doesn't accept arguments:
    '====Excell help=====
    SendMail method....
    Sends the workbook by using the installed mail system
    '====Word help=====
    SendMail method....
    Opens a message window for sending the specified document through Microsoft Exchange.


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now