Consulting

Results 1 to 2 of 2

Thread: Excel send to mail recipients help

  1. #1

    Excel send to mail recipients help

    I have found a code that pops up with the send to mail recipients window and then automatically sends the sheet as a body. I need help figuring out how to have vba enter an email address and subject into this window within excel. All help would be much appreciated. Below is my current code:

    [vba]Option Explicit

    Sub SendSheet()

    Application.DisplayAlerts = False
    With Application
    ' .ScreenUpdating = False
    On Error Resume Next
    Select Case ActiveWorkbook.BuiltinDocumentProperties("Comments")
    Case Is <> "SentBefore"
    '//show the mail envelope\\
    With ActiveWorkbook
    .EnvelopeVisible = True
    '//mark the workbook as being sent previously\\
    .BuiltinDocumentProperties("Comments") = "SentBefore"
    End With
    Case "SentBefore"
    '//activate the mail window (screen updating=false keeps it hidden)\\
    ActiveWorkbook.EnvelopeVisible = True

    With .CommandBars("Send To")
    '//IF the control "Send Now" is missing the code will error out, so add it\\
    .Controls.Add Type:=msoControlButton, ID:=3708

    With .Controls("Send Now")

    '//sends activesheet in email body\\
    .Execute

    '//remove the "Send Now" control added for this procedure\\
    .Delete

    End With
    End With
    End Select
    ' .ScreenUpdating = True
    End With
    Application.DisplayAlerts = True
    End Sub[/vba]
    Last edited by Joeryan101; 06-04-2008 at 06:14 AM.

  2. #2
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Google "Ron De Bruin Send Mail"
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

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