When checkbox1 is checked - it should send an email using outlook. If the checkbox1 should get unchecked, it shouldn't do anything. Right now anytime I click the check box it sends an email. I have tried an if then statement, but am getting runtime errors.
This is my code I have for the checkbox:
Sub CheckBox1_Click()
Dim OutlookApp As Object
Dim eItem As Object
Dim tid As String
Dim cOwner As String
Dim tOwner As String
Dim elist As String
Set OutlookApp = CreateObject("Outlook.Application")
Set eItem = OutlookApp.CreateItem(0)
tid = Sheet1.Range("A3").Text
cOwner = Sheet1.Range("G3").Text
tOwner = Sheet1.Range("E3").Text
elist = Sheet6.Range("D4").Value
If Sheet1.Shapes("Check Box 1").Value = True Then
With eItem
.to = elist
.Subject = "Audit Evidence Review Notice"
.HTMLBody = "" & cOwner & ", <br><br>" & _
"" & tOwner & " has completed evidence collection for " & tid & ".<br><br>" & _
"Evidence Location: Zoho Workdrive > SOC 2 Evidence > CA-100 > TA-100.1A<br><br>" & _
"Contact " & tOwner & " directly with any questions or concerns about the " & tid & " evidence.<br><br>" & _
"Go to the Compliance Application.xlsm to approve the evidence."
.Send
End With
MsgBox "" & cOwner & " has been successfully notified."
Else
End If
End Sub
Thank you!
This is my code I have for the checkbox:
Sub CheckBox1_Click()
Dim OutlookApp As Object
Dim eItem As Object
Dim tid As String
Dim cOwner As String
Dim tOwner As String
Dim elist As String
Set OutlookApp = CreateObject("Outlook.Application")
Set eItem = OutlookApp.CreateItem(0)
tid = Sheet1.Range("A3").Text
cOwner = Sheet1.Range("G3").Text
tOwner = Sheet1.Range("E3").Text
elist = Sheet6.Range("D4").Value
If Sheet1.Shapes("Check Box 1").Value = True Then
With eItem
.to = elist
.Subject = "Audit Evidence Review Notice"
.HTMLBody = "" & cOwner & ", <br><br>" & _
"" & tOwner & " has completed evidence collection for " & tid & ".<br><br>" & _
"Evidence Location: Zoho Workdrive > SOC 2 Evidence > CA-100 > TA-100.1A<br><br>" & _
"Contact " & tOwner & " directly with any questions or concerns about the " & tid & " evidence.<br><br>" & _
"Go to the Compliance Application.xlsm to approve the evidence."
.Send
End With
MsgBox "" & cOwner & " has been successfully notified."
Else
End If
End Sub
Thank you!