VBA: Email cells as a picture through Outlook plus add text and signature

helpsky

New Member
Joined
May 13, 2018
Messages
7
Hi! Below is the code I am using and it works, it pasted the cells into an email as an imagine BUT how do I add text before the image? I want the text right before the image and it just has to say “today”

Also, this deleted my outlook signature when it pastes into the email, is there a way to put in my signature through vba?

Code:
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Sub Send()

'Copy range of interest
Dim r As Range
Set r = Range("B3:F23")
r.Copy

'Open a new mail item
Dim outlookApp As Outlook.Application
Set outlookApp = CreateObject("Outlook.Application")
Dim outMail As Outlook.MailItem
Set outMail = outlookApp.CreateItem(olMailItem)


'You can specify the new email recipients, subjects here using the following lines:
outMail.Display
'outMail.To = "email@hello.com"
outMail.Subject = "test"
'outMail.Send --> directly send out this email

Dim wordDoc As Word.Document
Set wordDoc = outMail.GetInspector.WordEditor

'To paste as picture
wordDoc.Range.PasteAndFormat wdChartPicture

End Sub</code>
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Re: VBA: email cells as a picture thorugh putlook plus add text and signature to email

First, replace...

Code:
r.Copy

with

Code:
r.CopyPicture xlScreen, xlBitmap

Then try...

Code:
wordDoc.Application.Selection.TypeText "today"
wordDoc.Application.Selection.TypeParagraph
wordDoc.Application.Selection.TypeParagraph
wordDoc.Application.Selection.Paste

Hope this helps!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,138
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top