Copy and Paste All Values and Keep Original Format of Pivot Tables to Outlook Email VBA

jaszz

New Member
Joined
Mar 25, 2019
Messages
5
I am trying to write a VBA code for sending an email of a sheet with 4 pivot tables. These pivot tables are formatted the way the client wants. I am able to copy and paste them to the Outlook email with formatting however:
1) The color of the pivot tables changes from blue to green
2) The autofit code I set in the Excel sheet is no longer being followed in the Outlook email

Here's my code for the copy and paste part:

Code:
[COLOR=#222222]Set TempWB = Workbooks.Add(1)[/COLOR][/COLOR]
With TempWB.Sheets(1)
    .Cells(1).PasteSpecial Paste:=1
    .Cells(1).PasteSpecial xlPasteFormats, , False, False
    .Cells(1).Select
    Application.CutCopyMode = False
    On Error Resume Next
    .DrawingObjects.Visible = True
    .DrawingObjects.Delete
    On Error GoTo 0
[COLOR=#242729][COLOR=#222222]End With[/COLOR]

Is there a way to just copy and paste the used range in my sheet to an Outlook Email without creating a temporary workbook? Please help thank you
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

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