Hello, I am sending emails from excel and my VBA is below. The issue is I need to pull the content (it is a sentance) from textbox 3 in my excel sheet, but it is currently writting textbox 3 instead of pulling its content. Thanks for help.
Sub CreateMail()
Dim rngSubject As Range
Dim rngTo As Range
Dim rngBody As Range
Dim rngWord As String
Dim objOutlook As Object
Dim objMail As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
With ActiveSheet
Set rngTo = .Range("O16")
Set rngSubject = .Range("O17")
Set rngBody = .Range(.Range("D15"), .Range("K25").End(xlDown))
End With
rngBody.CopyPicture xlScreen, xlBitmap
With objMail
.to = rngTo
.Subject = rngSubject
.Display 'Instead of .Display, you can use .Send to send the email _
or .Save to save a copy in the drafts folder
.Body = "TextBox3.Text"
End With
SendKeys "({END})"
SendKeys "({ENTER})"
SendKeys "({ENTER})"
SendKeys "^({v})", True
Set objOutlook = Nothing
Set objMail = Nothing
End Sub
Bookmarks