TextBox Values to Outlook
Hi
Add it to the message
ProjName = Userform1.txbProjName.Value
Unload Userform1
'more code
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4" & vbNewLine & _
"Project name is " & ProjName
'more code
regards
Paul
PW11111 wrote:
Hi,
Can I amend the following code so it inserts the values from a tex tbox on a
userform into an outlook message.
For example I have a textbox - txbProjName on my userform that shows the
projects full name.
Any help would be great.
Sub Mail_small_Text_Outlook()
' Is working in Office 2000-2007
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = "WorkPlace Strategy: Executive Summery"
.Body = strbody
.Display 'or use .Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
|