Question : Excel Paste as Picture printing shapes flagged to not print.

Hello experts,

I am trying to... "Paste/As Picture/Copy as Picture/As Shown when printed" .....a portion of a sheet containing both data columns and shapes.  I do not want the shapes to print, and have flagged the shapes in the shape's properties window to not print, yet when I  "Paste/As Picture/Copy as Picture/As Shown when printed"....the shape is also printed.  Is their VBA code to prevent this?   I have attached a sample.

Thanks for the help!    
Attachments:
 
Excel 2007 xlsm
 

Answer : Excel Paste as Picture printing shapes flagged to not print.

Hello biker9,

when you use CopyPicture, you are copying the image as it appears on the screen. The print settings for the shape are ignored. It's rather like taking a screenshot, not like sending the range to the printer (in which case the shape would not be printed).

As a workaround, you can set the fill and border of the shape to msoFalse before copying the range (as a range or a picture) and then, after the copy operation, restore the fill and border (with msoTrue)

The attached code snippet works on your example.

cheers, teylyn
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
Sub Print_as_Pic()
'
    With ActiveSheet.Shapes.Range(Array("Rectangle 11"))
        .Fill.Visible = msoFalse
        .Line.Visible = msoFalse
    End With
    Range("B2:F22").Copy Range("J2")
    With ActiveSheet.Shapes.Range(Array("Rectangle 11"))
        .Fill.Visible = msoTrue
        .Line.Visible = msoTrue
    End With
    Range("P4").Select

End Sub
Random Solutions  
 
programming4us programming4us