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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Forum statistics

Threads
1,226,730
Messages
6,192,708
Members
453,748
Latest member
akhtarf3

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