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

0

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:

Set TempWB = Workbooks.Add(1)
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
End With

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

ana2

Posted 2019-04-09T13:25:54.980

Reputation: 3

No answers