ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hiding picture while printing (https://www.excelbanter.com/excel-programming/345476-hiding-picture-while-printing.html)

ermeko

hiding picture while printing
 
hi,
i need to hide a picture in excel while printing programatically.

thanks,

ermeko

hiding picture while printing
 
I MEEN IF IT IS POSSIBLE TO MAKE IT UNVISIBLE ON PRINT OUT.

THANKS,

"ermeko" wrote:

hi,
i need to hide a picture in excel while printing programatically.

thanks,


chijanzen

hiding picture while printing
 
ermeko:

Add a VBA module to your project and add this code to it.

Sub Pic_Visible()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
shp.Visible = True
End If
Next shp
End Sub

'add this code to Thisworkbook Module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
shp.Visible = False
End If
Next shp
Application.OnTime Now + TimeValue("00:00:01"), "Pic_Visible"
End Sub



--

http://www.vba.com.tw/plog/


"ermeko" wrote:

I MEEN IF IT IS POSSIBLE TO MAKE IT UNVISIBLE ON PRINT OUT.

THANKS,

"ermeko" wrote:

hi,
i need to hide a picture in excel while printing programatically.

thanks,


ermeko

hiding picture while printing
 
THE CODE DID NOTHING.

THE CODE BELLOW IS IN THE VB APPLICATION
objWrk.ActiveSheet.Shapes.AddPicture RESIM, True, True, 160, 340, 350, 350

THIS IS HOW I INSERT THE PICTURE TO THE EXCEL FILE. MAYBE THIS WILL HELP.
AND THERE IS ONLY ONE PICTURE

THANKS,
"chijanzen" wrote:

ermeko:

Add a VBA module to your project and add this code to it.

Sub Pic_Visible()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
shp.Visible = True
End If
Next shp
End Sub

'add this code to Thisworkbook Module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
shp.Visible = False
End If
Next shp
Application.OnTime Now + TimeValue("00:00:01"), "Pic_Visible"
End Sub



--

http://www.vba.com.tw/plog/


"ermeko" wrote:

I MEEN IF IT IS POSSIBLE TO MAKE IT UNVISIBLE ON PRINT OUT.

THANKS,

"ermeko" wrote:

hi,
i need to hide a picture in excel while printing programatically.

thanks,


Ron de Bruin

hiding picture while printing
 
You can try this

ActiveSheet.Shapes("Picturename").Visible = False


Or for all pictures

Sub Shapes2()
'Loop through the Shapes collection and use the Type number of the control
Dim myshape As Shape
For Each myshape In ActiveSheet.Shapes

If myshape.Type = 13 Then myshape.Visible = False

Next myshape
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ermeko" wrote in message ...
THE CODE DID NOTHING.

THE CODE BELLOW IS IN THE VB APPLICATION
objWrk.ActiveSheet.Shapes.AddPicture RESIM, True, True, 160, 340, 350, 350

THIS IS HOW I INSERT THE PICTURE TO THE EXCEL FILE. MAYBE THIS WILL HELP.
AND THERE IS ONLY ONE PICTURE

THANKS,
"chijanzen" wrote:

ermeko:

Add a VBA module to your project and add this code to it.

Sub Pic_Visible()
Dim shp As Shape
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
shp.Visible = True
End If
Next shp
End Sub

'add this code to Thisworkbook Module
Private Sub Workbook_BeforePrint(Cancel As Boolean)
For Each shp In ActiveSheet.Shapes
If shp.Type = 13 Then
shp.Visible = False
End If
Next shp
Application.OnTime Now + TimeValue("00:00:01"), "Pic_Visible"
End Sub



--

http://www.vba.com.tw/plog/


"ermeko" wrote:

I MEEN IF IT IS POSSIBLE TO MAKE IT UNVISIBLE ON PRINT OUT.

THANKS,

"ermeko" wrote:

hi,
i need to hide a picture in excel while printing programatically.

thanks,




Dave Peterson

hiding picture while printing
 
Why not just
rightclick on the picture
select format picture
Properties tab
uncheck the Print object box

But this kind of code will toggle that setting:

Option Explicit
Sub testme()
Dim myPict As Picture
With ActiveSheet
Set myPict = .Pictures("Picture 1")
myPict.PrintObject = False
.PrintOut preview:=True
myPict.PrintObject = True
End With
End Sub

ermeko wrote:

hi,
i need to hide a picture in excel while printing programatically.

thanks,


--

Dave Peterson


All times are GMT +1. The time now is 02:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com