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. Anonymous
    2011-08-26T14:07:25+00:00

    Thanks. I found this before but I get an error. I wonder if this is releated to Word 2010. It says "That method is not available in that object". It stops at the first line.

    Any ideas?

    Activedocument.HasRoutingSlip = True

    With Activedocument.RoutingSlip

        .Subject = "New subject goes here"

        .AddRecipient "******@Mail.com"

        .AddRecipient "******@Mail.com"

        .Delivery = wdAllAtOnce

    End With

    Activedocument.Route

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2011-08-26T13:35:39+00:00

    Was this answer helpful?

    0 comments No comments
  3. HansV 462.6K Reputation points
    2011-08-26T13:34:14+00:00

    Oops, sorry! I didn't pay attention.

    See http://word.mvps.org/faqs/interdev/sendmail.htm.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2011-08-26T12:56:04+00:00

    Thanks.

    It's telling me that an object is required. Should ActiveWorkbook say ActiveDocument? This is for Word.

    Private Sub CommandButton1_Click()

    ActiveWorkbook.SendMail "e-mail_address_here", "Monthly report"

    End Sub

    Was this answer helpful?

    0 comments No comments