Hi All
Can someone please take a look at my code and tell me why I am getting "variable not defined" error?
Thank You
Dan
Private Sub CommandButton1_Click()
                       


Dim OutApp As Object
Dim strCC As String
Dim strTO As String
    Set OutApp = CreateObject("Outlook.Application")
    OutApp.Session.Logon
    Set OutMail = OutApp.CreateItem(0)
    On Error Resume Next
'****
If ComboBox31.ListIndex <> -1 Then
For i = 0 To ComboBox31.ListCount - 1
If ComboBox31.Selected(i) Then
If strCC = vbNullString Then
strCC = ComboBox31.List(i)
Else
strCC = strCC & "; " & ComboBox31.List(i)
End If
End If
Next
End If

 With OutMail
        .To = strTO
        .cc = strCC
        .Subject = "NCN Response"
        .Body = "" & vbNewLine & vbNewLine _
        & "reference:" & " " & ActiveCell.Value & vbNewLine _
        & "Date Raised:" & " " & TextBox3.Value & vbNewLine _
        & "Shift:" & " " & ComboBox1.Value & vbNewLine _
        & "Area od Audit:" & " " & ComboBox3.Value & vbNewLine _
        & "Line Number:" & " " & ComboBox6.Value & vbNewLine _
        & "Product:" & " " & ComboBox5.Value & vbNewLine _
        & "Legal:" & " " & ComboBox7.Value & vbNewLine _
        & "Issued by:" & " " & ComboBox3.Value & vbNewLine _
        & "Issued to:" & " " & ComboBox12.Value & "," & " " & ComboBox13.Value & "," & " " & ComboBox14.Value & vbNewLine _
        & "Immediate Corrective Action:" & " " & TextBox2.Value & vbNewLine _
        & "Date Agreed For Corrective Action Completion:" & " " & TextBox7.Value & vbNewLine _
        & "Issue Description:" & " " & TextBox1.Value & vbNewLine _
        & "Non-Conformance Type:" & " " & ComboBox28.Value & vbNewLine _
        & "Foreign Body Type:" & " " & ComboBox11.Value & vbNewLine _
        & "Document Type:" & " " & ComboBox27.Value & vbNewLine _
        & "Document Ref:" & " " & ComboBox8.Value & vbNewLine _
        & "Document Section:" & " " & TextBox52.Value & vbNewLine _
        & "...cheers!"
        
        .SentOnBehalfOfName = ""
        .display '.Send
    End With