I am using VBA to send emails of a range of cells within excel. The size of the table goes haywire and all the text being wrap up when I copy over to outlook.
I wo
You can do it by breaking into parts.
First you will need to extract the data you need to a new worksheet. You can delete the worksheet later.
If you wish to copy the format as well, you can use
something like ThisWorkbook.Sheets("Copy").Range("A1").PasteSpecial Paste:=xlPasteFormats
. You might need xlPasteFormats
, xlPasteColumnWidths
& xlPasteValues
.
To create new worksheet: Sheets.Add(, Sheets(Sheets.Count)).name = "worksheetName"
MailEnvelop Example
Sub sendEmail()
ThisWorkbook.EnvelopeVisible = True
With ThisWorkbook.Sheets("Copy").MailEnvelope
.Introduction = "This is the email message"
.Item.To = "abc@domain.com"
.Item.Subject = "Subject"
.Item.Send
End With
ThisWorkbook.EnvelopeVisible = False
'Delete the the worksheet
ThisWorkbook.Sheets("Copy").Delete
End Sub
Read here for some good guidelines: https://www.rondebruin.nl/win/s1/outlook/mail.htm