Private Sub CommandButton1_Click()
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String
Dim PolicyNumber As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strto = "someaddress@yahoo.com"
'I didn't use the actual address I use
If Range("C21") <> "" Then
PolicyNumber = Range("C21")
strcc = "anotheraddress@yahoo.com"
strbcc = ""
strsub = ProbTopicBox & ", " & PolicyNumber
strbody = "Agent Number:" & AgentNumberBox & vbCrLf & "Agency Name: " & AgencyBox & vbCrLf & "Agent:" & AgentBox & vbCrLf & vbCrLf & ProblemBox
Else
strcc = "anotheraddress@yahoo.com
strbcc = ""
strsub = ProbTopicBox & " (not policy specific)"
strbody = "Agent Number:" & AgentNumberBox & vbCrLf & "Agency Name: " & AgencyBox & vbCrLf & "Agent:" & AgentBox & vbCrLf & vbCrLf & ProblemBox
End If
With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
Me.Hide
End Sub
Bookmarks