bvanscoy678
Member
Hi,
I have a very simple piece of code that copy/paste a range into a body of an email. It works just fine with the exception of the form control. I have a combo box that overlays E3 and it populates the value in E3. I don't want to see both the value in E3 and the combo box as it is showing me now.
https://www.dropbox.com/s/xr3hvm7d7un4be4/EE%20MAC%20and%20EMAIL%20address.xlsm
Thanks! Brent
[pre]
[/pre]
I have a very simple piece of code that copy/paste a range into a body of an email. It works just fine with the exception of the form control. I have a combo box that overlays E3 and it populates the value in E3. I don't want to see both the value in E3 and the combo box as it is showing me now.
https://www.dropbox.com/s/xr3hvm7d7un4be4/EE%20MAC%20and%20EMAIL%20address.xlsm
Thanks! Brent
[pre]
Code:
'
Sub CreateMail()
Dim rngSubject As Range
Dim rngTo As Range
Dim rngBody As Range
Dim objOutlook As Object
Dim objMail As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
With ActiveSheet
Set rngTo = .Range("j2")
Set rngSubject = .Range("A2")
Set rngBody = ActiveSheet.Range("A1:H36")
End With
rngBody.Copy
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
End With
SendKeys "^({v})", True
Set objOutlook = Nothing
Set objMail = Nothing
End Sub