I have two checkboxes on my Form1, one is called "CheckOE" and the other "CheckCDO"
I would like to have an option of sending email message using either Outlook or CDO.
Both email codes work fine if placed in the button alone, but I dont' know how to skip either Outlook or CDO code depending on what checkbox is checked and both codes placed inside the same button. I have typed If Else there just to give a clue on what I want to be able to accomplish. Please help! I doing this in MS VB 2008 Express. Here is my code:

'*******************************

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

If CheckOE = 1 Then

'Create a new message using Outlook
objOutlk = CreateObject("Outlook.Application")
objMail = objOutlk.createitem(olMailItem)
If ComboBox1.Text = "" Then
objMail.To = ""
Else
End If
If ComboBox1.Text = "" Then
objMail.To = ""
Else
End If
objMail.cc = ""
'Set up Subject Line)
objMail.subject = ""
'Add the body
If ComboBox1.Text = "" Then
strMsg = "," & "" & vbCrLf
strMsg = strMsg & "" & vbCrLf
strMsg = strMsg & "" & vbCrLf
strMsg = strMsg & "" & vbCrLf
strMsg = strMsg & "" & vbCrLf
strMsg = strMsg & "" & vbCrLf
strMsg = strMsg & "" & vbCrLf
objMail.attachments.add("")
objMail.body = strMsg
Else
End If
objMail.Display()
objMail = Nothing
objOutlk = Nothing

Else
End If

'*******************************

If CheckCDO = 1 Then
'Create and send message ussing CDO

Const ForReading = 1
Dim strBody

Dim fso = CreateObject("Scripting.FileSystemObject")
Dim f = fso.OpenTextFile("", ForReading)
strBody = f.ReadAll
' Close the file
f.Close()
f = Nothing
fso = Nothing
Dim iMsg, iConf, Flds
Dim schema As String
Dim SendEmail As Integer
iMsg = CreateObject("CDO.Message")
iConf = CreateObject("CDO.Configuration")
Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = ""
Flds.Item(schema & "smtpserverport") = 25
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = ""
Flds.Item(schema & "sendpassword") = ""
Flds.Item(schema & "smtpusessl") = 0
Flds.Update()

With iMsg
.To = ""
.CC = ""
.From = ""
.Subject = ""
.HTMLBody = strBody '""
.AddAttachment("")
.Sender = ""
.Organization = ""
.ReplyTo = ""
.Configuration = iConf
SendEmail = .Send
End With

iMsg = Nothing
iConf = Nothing
Flds = Nothing

Else
End If

End Sub


End Class

'*******************************

This question has already been answered. Start a new discussion instead.