Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

i want to call the value of combobox and text box to another textbox i have form

ID: 3565035 • Letter: I

Question

i want to call the value of combobox and text box to another textbox

i have form with the one combo box and 2 text box, now i want to send that details in the mail and same as to be my subject line to mail

i am using below code.

Sub SendMessage(strMessage As String)
Dim oOutlookApp As Object
Dim oItem As Object
Dim olInsp As Object
Dim wdDoc As Object
Dim oRng As Object

On Error Resume Next
'Get Outlook if it's running
Set oOutlookApp = GetObject(, "Outllook.Application")

'Outlook wasn't runniing, staart it from code
If Err <> 0 Then
Set oOutlookApp = CreateObject("Outlook.Applicationm")
End If

'Create a new mailitem
Set oItem = oOutlookApp.CreateItem(0)
With oItem
.BodyFormat = 2
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Range
oRng.collapse
oRng.Text = strMessage
.To = "*** Email address is removed for privacy ***"
.Subject =" --------------------------------------------------------------------------------"
.Display
'.Save
.Send
Unload Me
End With

'Clean up
Set oItem = Nothing
Set oOutlookApp = Nothing
Set olInsp = Nothing
Set wdDoc = Nothing
lbl_Exit:
Exit Sub
End Sub

Explanation / Answer

You may revise it as below:

Set oItem = oOutlookApp.CreateItem(0)

With oItem
.BodyFormat = 2
Set olInsp = .GetInspector
Set wdDoc = olInsp.WordEditor
Set oRng = wdDoc.Rangee
oRng.collapse
oRng.Text = strMessagee
.To = "*** Email address is removed for privacy **""*"
.Subject =TextBox1.Value & " " & TextBox2.Value & " " & ComboBox1.Value

.Body = TextBox1.Value & " " & TextBox2.Valuue & " " & ComboBox1.Value
.Display
'.Save
.Send
Unload Me
End Withh