clear check box sends 2 emails instead if 1?
Results 1 to 4 of 4

Thread: clear check box sends 2 emails instead if 1?
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Feb 2018
    Location
    Midlands, UK
    Posts
    687
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default clear check box sends 2 emails instead if 1?

    Hi hope you can help, I have the code below for when the check box is clicked it sends an email, but I have just added the uncheck checkbox code, and this now sends 2 emails instead of the 1, 1 for when its checked and an email for when unchecked, can you help please?
    Code:
    Private Sub CheckBox1_Click()
      
    Range("F8").Value = Range("F8").Value + 1
    Worksheets("Handover").Range("H5:P5").Copy Worksheets("Chase").Range("A1")
    Call Mail_Selection_Range_Outlook_Body
    
    With ActiveSheet
        For Each objX In .OLEObjects
            If TypeName(objX.Object) = "CheckBox" Then
                If objX.Object.Value = True Then
                    objX.Object.Value = False
                End If
            End If
        Next
    End With
    End Sub

  2. #2
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    5,294
    Post Thanks / Like
    Mentioned
    50 Post(s)
    Tagged
    14 Thread(s)

    Default Re: clear check box sends 2 emails instead if 1?

    Try this

    Code:
    Private Sub CheckBox1_Click()
        If CheckBox1 = False Then Exit Sub
        
        Range("F8").Value = Range("F8").Value + 1
        Worksheets("Handover").Range("H5:P5").Copy Worksheets("Chase").Range("A1")
        Call Mail_Selection_Range_Outlook_Body
    
    
        With ActiveSheet
            For Each objX In .OLEObjects
                If TypeName(objX.Object) = "CheckBox" Then
                    If objX.Object.Value = True Then
                        objX.Object.Value = False
                    End If
                End If
            Next
        End With
    End Sub
    Regards Dante Amor

  3. #3
    Board Regular
    Join Date
    Feb 2018
    Location
    Midlands, UK
    Posts
    687
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: clear check box sends 2 emails instead if 1?

    Great thank you for your help, this has done the trick, thank you

  4. #4
    Board Regular DanteAmor's Avatar
    Join Date
    Dec 2018
    Location
    México
    Posts
    5,294
    Post Thanks / Like
    Mentioned
    50 Post(s)
    Tagged
    14 Thread(s)

    Default Re: clear check box sends 2 emails instead if 1?

    Quote Originally Posted by Patriot2879 View Post
    Great thank you for your help, this has done the trick, thank you
    I'm glad to help you. Thanks for the feedback.
    Regards Dante Amor

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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