Number1One
New Member
- Joined
- Mar 1, 2019
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hi All,
Have the below code, almost there, but body text is currently going below the copied table and also want to add a signature.
Code- to copy visible cells in range into email body.
Have the below code, almost there, but body text is currently going below the copied table and also want to add a signature.
Code- to copy visible cells in range into email body.
Sub SendEmail()
Dim OutlookApp As Object
'Dim OutlookApp As Outlook.Application
Dim MItem As Object
'Dim MItem As Outlook.MailItem
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")
'Set OutlookApp = New Outlook.Application
Dim Sendrng As Range
Set Sendrng = Worksheets("report").Range("C2:L63").SpecialCells(xlCellTypeVisible)
Sendrng.Copy
'Create Mail Item
Set MItem = OutlookApp.CreateItem(0)
'Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.To = "test@email.com"
.Subject = "report"
.CC = ""
.BCC = ""
.Body = "Email body text here"
.Display
End With
SendKeys "^({v})", True
DoEvents
With MItem
'.Send
End With
Set OutlookApp = Nothing
Set MItem = Nothing
End Sub