VBA Run Time Error - Type Mismatch

Hello Experts,

I am currently using VBA code in my UserForm in Outlook and I'm getting and error - but can't figure out where my problem lies.  I think it has something to do with the data type of my variables - but idk.

Error - RunTime Error '13' - Type Mismatch

And it's selecting the line (highlights in yellow): Reason(1) = cboReason1.Value

Option Explicit
Private Sub RARequest_Activate()


    cboReason1.AddItem "Test 1"
    cboReason2.AddItem "Test 2"
    cboReason3.AddItem "Test 3"
    cboReason4.AddItem "Test 4"
    cboReason5.AddItem "Test 5"
    Do cboReason1.ListIndex = 0
'    lbEmails.AddItem "Sample Request"
'    lbEmails.AddItem "Quote Request"
'    lbEmails.AddItem "Return Authorization Request"
'    lbEmails.AddItem "Order Expedite Request"
End Sub

Private Sub GenerateEmail_Click()


    Unload SampleRequest

    Dim mai As MailItem
    Dim Reason(1 To 5) As Integer
    Dim i As Integer
    Dim strText, RequestNotes As String
    Dim CustNum, CustName, ContNum, ContName As String
    Dim OrderNum, Reason1, Reason2, Reason3, Reason4, Reason5 As String

    CustNum = txtCustNum.Value
    CustName = StrConv(txtCustName.Value, vbUpperCase)
    ContNum = txtContNum.Value
    ContName = StrConv(txtContName.Value, vbUpperCase)
    RequestNotes = txtNotes.Value
    OrderNum = txtOrderNum.Value
    Reason(1) = cboReason1.Value
    Reason(2) = cboReason2.Value
    Reason(3) = cboReason3.Value
    Reason(4) = cboReason4.Value
    Reason(5) = cboReason5.Value

    strText = "<b><u>R/A REQUEST</b></u>"
    strText = strText & "<br><br>"
    strText = strText & "<b><u>CUSTOMER INFORMATION</b></u>"
    strText = strText & "<br><br>"
    strText = strText & "<b>Customer: </b>" & ContNum & " | " & ContName
    strText = strText & "<br>"
    strText = strText & "<b>Contact: </b>" & ContNum & " | " & ContName
    strText = strText & "<br><br>"
    strText = strText & "<b><u>ORDER INFORMATION</b></u>"
    strText = strText & "<br><br>"
    strText = strText & "<b>Order #: </b>" & OrderNum
    strText = strText & "<br><br>"

    For i = 1 To 5
        If Reason(i) <> 0 Then 'or <> "" Then
            strText = strText & "<b>Reason " & i & "</b>" & " - " & Reason(i)
            strText = strText & "<br>"
        End If
    Next i

    strText = strText & "<br>"
    strText = strText & "<b><u>ADDITIONAL INFORMATION</b></u>"
    strText = strText & "<br><br>"
    strText = strText & RequestNotes
    strText = strText & "<br><br>"

    Set mai = Application.CreateItem(olMailItem)
    With mai
        .To = "geekamo@me.com"
        .CC = "geekamo@me.com"
        .Subject = "R/A (RQ) | " & CustNum & " - " & CustName & " | " & ContNum & " - " & ContName
        .HTMLBody = "<p style='font-family:calibri'>" & strText & "</p>"
    End With

End Sub

Open in new window

Thank you in advance for your help!

~ Geekamo
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Reason(1) = cboReason1.Text ' Not Value
GeekamoAuthor Commented:
@ MartinLiss,

It's still showing the same error.  Any ideas?

~ Geekamo
Martin LissOlder than dirtCommented:
How about this?

    Reason(1) = cboReason1.List(cboReason1.ListIndex)
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

GeekamoAuthor Commented:
@ MartinLiss,

Nope, it doesn't like that either.

~ Geekamo
Martin LissOlder than dirtCommented:
Oh! It's simply this

Dim Reason(1 To 5) As Integer

Your combobox entry values aren't numbers they are strings and so you should do

 Dim Reason(1 To 5) As String

which would work even if they were numbers (but less efficiently). If this works with your 'Value' or my 'Text' or ListIndex suggestions then can you do me a favor and close both this and the other question of yours where I pointed out the Activate event?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GeekamoAuthor Commented:
Perfect!  Thank you so much!
Martin LissOlder than dirtCommented:
You're welcome and I'm glad I was able to help.

Marty - MVP 2009 to 2013
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.