Share via

VBA code for send e-mail button

Anonymous
2011-08-24T17:37:12+00:00

Hello,

I'm trying to find some Word VBA code that I can use to send an active document as an e-mail attachment.

  • I will attach it to a button
  • We're using Windows 7 and Office 2010

Can anyone help me?

Thanks

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2011-08-26T14:28:49+00:00

Although the methods and properties for routing slips are still present in Word VBA, they cannot be used any more starting with Word 2007.

Try this instead:

Sub Test()

    Options.SendMailAttach = True

    ActiveWindow.EnvelopeVisible = True

    With ActiveDocument.MailEnvelope.Item

        .Subject = "Testing 123"

        .Recipients.Add "******@somewhere.com"

    End With

End Sub

Was this answer helpful?

0 comments No comments

18 additional answers

Sort by: Most helpful
  1. HansV 462.6K Reputation points
    2011-08-24T19:15:48+00:00

    Do you want to display the e-mail so that the user can enter the recipient(s) etc., or do you want to provide all necessary info in the macro and send the message automatically?

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. HansV 462.6K Reputation points
    2011-08-25T21:22:59+00:00

    Try

    ActiveWorkbook.SendMail "******@somewhere.com", "Monthly report"

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2011-08-25T19:53:30+00:00

    Hans,

    As usual, people change their minds. :)  Back to your question, here is the new requirements:

    1. Attach active document to email
    2. Address it to an e-mail address (e.g., ******@test.com)
    3. Insert some text – “ in the subject field

    Let me know if you can help. Thanks!

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-08-24T19:38:37+00:00

    I found it:

    Activedocument.SendMail

    Was this answer helpful?

    0 comments No comments