Resizing a range of cells and copy and paste to an email using vba

Patches01

New Member
Joined
Aug 11, 2021
Messages
21
Office Version
  1. 365
Platform
  1. Windows
Hi All
I want to resize a range of cells and copy and paste them to an email using a vba.
This is where I am at so far.
Private Sub CommandButton3_Click()


Dim OutApp As Object
Dim OutMail As Object
Dim table As Range
Dim pic As Picture
Dim ws As Worksheet
Dim wordDoc


Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

'grab table, convert to image, and cut
Set ws = ThisWorkbook.Sheets("Sheet1")
Set table = ws.Range("A1:J25")
ws.Activate
table.Copy
Set pic = ws.Pictures.Paste
pic.Cut

'create email message
On Error Resume Next
With OutMail
.to = ""
.CC = ""
.BCC = ""
.Subject = "Daily Gaming Figures "
.Display

Set wordDoc = OutMail.GetInspector.WordEditor
With wordDoc.Range
.PasteAndFormat wdChartPicture
.InsertParagraphAfter
.InsertParagraphAfter
.InsertAfter ""
.InsertParagraphAfter
.InsertAfter ""
End With

.HTMLBody = "<BODY style = font-size:11pt; font-family:Calibri >" & _
"Good morning Mazen & Chris, <p> Please find below the Daily Gaming Figures for your viewing: <p>" & .HTMLBody

End With
On Error GoTo 0

Set OutApp = Nothing
Set OutMail = Nothing



End Sub

Any suggestions would be greatly appreciated.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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