Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Button2_Click()
- If ApproveRejectButton = 1 Then
- Dim xOutApp As Object
- Dim xOutMail As Object
- Dim xMailBody As String
- On Error Resume Next
- Set xOutApp = CreateObject("Outlook.Application")
- Set xOutMail = xOutApp.CreateItem(0)
- xMailBody = "Body content" & vbNewLine & vbNewLine & _
- "This is line 1" & vbNewLine & _
- "This is line 2"
- On Error Resume Next
- With xOutMail
- .To = "Email Address"
- .CC = ""
- .BCC = ""
- .Subject = "Test email send by button clicking"
- .Body = xMailBody
- .Display 'or use .Send
- End With
- On Error GoTo 0
- Set xOutMail = Nothing
- Set xOutApp = Nothing
- ' Approve button code goes here
- Else
- ' Reject button code goes here
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement