+ Reply to Thread
Results 1 to 7 of 7

Emailing CheckBox Label Value

Hybrid View

  1. #1
    Registered User
    Join Date
    01-27-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    16

    Emailing CheckBox Label Value

    Hi Folks,

    Quick question that I'm not sure whether or not is answerable. I have no problem emailing a copy of my userform's text boxes and combo boxes. The issue I am having is when it comes to check boxes. Is it possible to do one of the two following things in regards to emailing?

    A) Have the label of a checkbox copied into email if the box is checked?

    or

    B) If I type the label name in the email coding, is it possible to have yes or no displayed based on whether or not the checkbox is checked?

    If either one is possible, could you provide the coding assuming the checkboxes are named box1, box2, etc.?

    Thank you!

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Emailing CheckBox Label Value

    Hello rvinc,

    You can do either one. Personally, I would go with "B" because it is easier
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    01-27-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Emailing CheckBox Label Value

    Hi Leith,

    Thank you for the response. Would you happen to have the coding I could use so checkbo=checked displays "yes"? I haven't put the code together yet for this form which is why I can't post a copy of the code for you.

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Emailing CheckBox Label Value

    Hello rvinci,

    Do you have a workbook you can post?

    For best results, you should post your workbook. This will allow the code to be fully tested and debugged. Please include before and after examples of the data along with any notes.
    If your workbook contains sensitive information, please redact it before posting.

    How To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

  5. #5
    Registered User
    Join Date
    01-27-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Emailing CheckBox Label Value

    I have nothing in the workbook yet, I am still just working on the coding. Here is what I have so far if it helps:

    Private Sub UserForm_Initialize()
    
    'Populate Date Field
    Date1.Value = Format(Date, "mm/dd/yyyy")
    
    
    End Sub
    
    Private Sub Task_Change()
    Select Case Me.Task
    
    Case "Litigation":
    
    Entirefile.Visible = True
    Medicalonly.Visible = True
    Bandedsection.Visible = True
    mailtocounsel.Visible = True
    retainattorney.Visible = True
    suittransmittal.Visible = True
    suitack.Visible = True
    printnotes.Visible = True
    statesearch.Visible = True
    searchacct.Visible = True
    copyoptions.Visible = True
    litoptions.Visible = True
    
    Case "Photocopy":
    
    Entirefile.Visible = True
    Medicalonly.Visible = True
    Bandedsection.Visible = True
    mailtocounsel.Visible = True
    copyoptions.Visible = True
    
    Case Else:
    
    Entirefile.Visible = False
    Medicalonly.Visible = False
    Bandedsection.Visible = False
    mailtocounsel.Visible = False
    copyoptions.Visible = False
    retainattorney.Visible = False
    suittransmittal.Visible = False
    suitack.Visible = False
    printnotes.Visible = False
    statesearch.Visible = False
    searchacct.Visible = False
    litoptions.Visible = False
    
    End Select
    End Sub
    
    Private Sub Submit_Click()
    
    Dim OutApp As Object
        Dim OutMail As Object
        Dim strbody As String
        Dim repfunc As Variant
        
        repfunc = Application.WorksheetFunction.VLookup(Rep.Value, Worksheets("Form Data").Range("A:B"), 2, False)
        
        Set OutApp = CreateObject("Outlook.Application")
        OutApp.Session.Logon
        Set OutMail = OutApp.CreateItem(0)
         
        With OutMail
            .To = repfunc
            .Subject = "Request"
            sMsgBody = "Please review the below request information" & vbCr & vbCr & vbCr
            sMsgBody = sMsgBody & "Todays Date -- " + Me.Date1.Value & vbCr & vbCr
            sMsgBody = sMsgBody & "Rep's Name -- " + Me.Rep.Value & vbCr & vbCr
            sMsgBody = sMsgBody & "Department -- " + Me.Number.Value & vbCr & vbCr
            sMsgBody = sMsgBody & "Requested Item -- " + Me.Claimant.Value & vbCr & vbCr
            sMsgBody = sMsgBody & "Thank you" & vbCr & vbCr
            sMsgBody = sMsgBody & Me.Rep.Value
            .body = sMsgBody
    
            .Send
        End With
        On Error GoTo 0
         
        MsgBox "The e-mail was successfully sent!", vbInformation, "Finish"
         
        Set OutMail = Nothing
        Set OutApp = Nothing
    End Sub
    
    Private Sub Clear_Click()
    
    Rep.Value = Null
    Number.Value = Null
    Task.Value = Null
    Claimant.Value = Null
    Comments.Value = Null
    Entirefile.Value = Null
    Medicalonly.Value = Null
    Bandedsection.Value = Null
    mailtocounsel.Value = Null
    retainattorney.Value = Null
    suittransmittal.Value = Null
    suitack.Value = Null
    printnotes.Value = Null
    statesearch.Value = Null
    searchacct.Value = Null
    
    End Sub

  6. #6
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Emailing CheckBox Label Value

    Several examples.
    If Me.CheckBoz1 Then
        CKBox$ = "This checkBox IS CHECKED"
    End If
    
    'Or
    
    CKBox$ = IIf(Me.CheckBox1, "This is Checked", "This is NOT Checked")
    
    sMsgBody = TextBox1 & vbCr & vbCr & _
       ComboBox1 & vbCr & vbCr & _
       CheckBox1.Caption
       
    'Or
       
    sMsgBody = TextBox1 & vbCr & vbCr & _
       ComboBox1 & vbCr & vbCr & _
       CKBox$
     
    .body = sMsgBody
    David
    (*) Reputation points appreciated.

  7. #7
    Registered User
    Join Date
    01-27-2013
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    16

    Re: Emailing CheckBox Label Value

    Thankyou Tinbendr, you pointed me the way I needed. This was what I ended up with

    If Printhost.Value = True Then
    sMsgBody = sMsgBody & Printhost.Caption & vbCr & vbCr
    End If

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 6
    Last Post: 01-07-2014, 03:24 PM
  2. Replies: 1
    Last Post: 09-30-2013, 09:52 AM
  3. COPY LABEL FORM FROM EXCEL TO A LABEL
    By xrayAndi in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-05-2006, 10:25 AM
  4. checkbox true/false label
    By jashby2@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2005, 12:05 PM
  5. [SOLVED] Clicking checkbox Changes the Label Font
    By kcc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2005, 03:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1