I have a daily task to copy a range of cells into an email.
I managed to do this, with the range being formatted as a photo. (I learnt that copying a range in table format isn't as straight forward as it seems).
How do I code the size and format of the photo produced, height: 9cm, width: 28cm, format as square?
I think I need to do this via the Word editor. I tried .style.width
but it throws an error.
Sub email()
Dim ol As Object 'Outlook.Application
Dim olEmail As Object 'Outlook.MailItem
Dim olInsp As Object 'Outlook.Inspector
Dim wd As Object 'Word.Document
Sheets("Daily message").Range("B3:L21").SpecialCells(xlCellTypeVisible).Copy
Set ol = GetObject(, "Outlook.Application") '/* if outlook is running, create otherwise */
Set olEmail = ol.CreateItem(0) 'olMailItem
With olEmail
Set olInsp = .GetInspector
If olInsp.EditorType = 4 Then 'olEditorWord
Set wd = olInsp.WordEditor
wd.Range.PasteAndFormat 13 'wdChartPicture
End If
.To = "my email"
.BCC = ""
.Subject = "Daily message"
.Display
End With
End Sub