VBA to copy and paste pivot tables as pictures sometimes crops image

logandiana

Board Regular
Joined
Feb 21, 2017
Messages
107
I built a macro that copies portions of pivot tables and charts and then pastes these onto a tab as pictures one below the other. At the end of the macro the worksheet with all the pictures is copied to the clipboard and then is easily pasted into the body of an email to be sent out. The recipients of the email only need to see the final numbers in the pivots, they don't need to be able to manipulate the pivots themselves.

The macro works every time for me, but only sometimes works when my coworker runs the macro.
Here's the portion of the code in question.


Code:
morn.Select
morn.Columns("A:A").EntireColumn.AutoFit
morn.Range("A5:D" & Cells(24, 1).End(xlUp).Row).Copy
With eml
    .Select
    .Range("B3").Select
    ActiveSheet.Pictures.Paste.Select
End With
morn.Select
morn.Range("F28:J" & Cells(37, 6).End(xlUp).Row).Copy
With eml
    .Select
    .Range("B22").Select
    ActiveSheet.Pictures.Paste.Select
End With
week.Select
week.Range("H2:Q" & Cells(40, 8).End(xlUp).Row).Copy
With eml
    .Select
    .Range("B31").Select
    ActiveSheet.Pictures.Paste.Select
End With

When I run the macro, the complete selection is made and then pasted correctly.
Here's an example of what it would look like with just one of the pivot tables.
2ecp0yd.png




Here's what hers does when the macro is run on her computer.

21on2b4.png





We stepped through and it's copying the correct parts completely, but then it pastes a cropped in version of the selection on the email tab. On each of the 5 pivots in the procedure it does the same thing.
Again, this works 100% on my computer, but hers it is random whether it works or not.
Some setting we are not aware of?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
It may be the page width of he email is not supporting the image size....
 
Upvote 0
This is before it ever gets to any email, it does this all in excel. And the macro never writes anything to email. It only copies from one worksheet and pastes as a picture in another worksheet.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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