Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How select all pictures in a worksheet and make visible?

I have a vba code that has worked well for a while, but during some changes
all pictures become hidden when I run the code. I have searched for a
explanation and will contiune, but would need a quick and dirty solution
right now to just tell them in the end of the code like:
"Worksheet(1).pictures.visible = True" .

Of course is the above mentioned example not working, but it give the idea
of my needs. Probably the solutions is a for each..next solution and that's
ok, of cource.

NOTE:
You have to separate it from the chartobjects also within the worksheet
/

Reagrds



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How select all pictures in a worksheet and make visible?

Hi Gunnar,

Try changing:

Worksheet(1).pictures.visible = True

to:

Worksheets(1).Pictures.Visible = True


---
Regards,
Norman



"Gunnar Johansson" wrote in message
...
I have a vba code that has worked well for a while, but during some changes
all pictures become hidden when I run the code. I have searched for a
explanation and will contiune, but would need a quick and dirty solution
right now to just tell them in the end of the code like:
"Worksheet(1).pictures.visible = True" .

Of course is the above mentioned example not working, but it give the idea
of my needs. Probably the solutions is a for each..next solution and
that's ok, of cource.

NOTE:
You have to separate it from the chartobjects also within the worksheet
/

Reagrds





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How select all pictures in a worksheet and make visible?

Sorry,
That syntax doesn't work, that was just an example.

/Regards

"Norman Jones" skrev i meddelandet
...
Hi Gunnar,

Try changing:

Worksheet(1).pictures.visible = True

to:

Worksheets(1).Pictures.Visible = True


---
Regards,
Norman



"Gunnar Johansson" wrote in message
...
I have a vba code that has worked well for a while, but during some
changes all pictures become hidden when I run the code. I have searched
for a explanation and will contiune, but would need a quick and dirty
solution right now to just tell them in the end of the code like:
"Worksheet(1).pictures.visible = True" .

Of course is the above mentioned example not working, but it give the
idea of my needs. Probably the solutions is a for each..next solution and
that's ok, of cource.

NOTE:
You have to separate it from the chartobjects also within the worksheet
/

Reagrds







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How select all pictures in a worksheet and make visible?

The only time I've seen Norman's suggestion fail was when there were lots of
pictures on that worksheet. (You sure you wanted to use worksheets(1)--maybe it
would be better like:

Worksheets("sheet1").Pictures.Visible = False

(change sheet1 to the correct name)

if it doesn't work, one workaround is to iterate through the pictures:

Dim myPict As Picture
For Each myPict In ActiveSheet.Pictures
myPict.Visible = True
Next myPict


Gunnar Johansson wrote:

Sorry,
That syntax doesn't work, that was just an example.

/Regards

"Norman Jones" skrev i meddelandet
...
Hi Gunnar,

Try changing:

Worksheet(1).pictures.visible = True

to:

Worksheets(1).Pictures.Visible = True


---
Regards,
Norman



"Gunnar Johansson" wrote in message
...
I have a vba code that has worked well for a while, but during some
changes all pictures become hidden when I run the code. I have searched
for a explanation and will contiune, but would need a quick and dirty
solution right now to just tell them in the end of the code like:
"Worksheet(1).pictures.visible = True" .

Of course is the above mentioned example not working, but it give the
idea of my needs. Probably the solutions is a for each..next solution and
that's ok, of cource.

NOTE:
You have to separate it from the chartobjects also within the worksheet
/

Reagrds






--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How select all pictures in a worksheet and make visible?

Thank you Norman, Tom and Dave!

It work now. The pictures was_not_hidden_! When I ran following code to
"exchange" chartobjects to pics (less trouble when users paste them into
powerpoint, secure source links of the charts etc) it pasted an object (the
picture?) a few pixels big and scaled it up 3600% to right size - same as
the chart. Since Excel doesn't allow this kind of big numbers in the
prercentage fields of the pictures, it went into trouble.

It work ok now, both this sub below (has not changed it, but now it's ok)
and of course the: Sheet102.Pictures.Visible = True
About the name of the sheet: I always use the CodeName in the code

I don't need an reply of this, just want to share my code and experience to
you. /Regards


Good Sub to create Pictures instead of chartsobjects in a worksheet
and then hide the charts for protection:

Sub CreatePicsHideCharts()
On Error GoTo ErrorHandler
Dim chtobj As ChartObject

Application.EnableEvents = False
Application.ScreenUpdating = False

Sheet102.Pictures.Delete
Sheet102.ChartObjects.Visible = True
Sheet102.Activate
Sheet102.Range("A1").Select

For Each chtobj In Sheet102.ChartObjects
chtobj.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Sheet102.Paste
Selection.Visible = True
With Selection
.Left = chtobj.Left
.Top = chtobj.Top
.Width = chtobj.Width
.Height = chtobj.Height
End With

chtobj.Chart.ProtectData = False
chtobj.Visible = False
chtobj.Chart.ProtectData = True
Next chtobj

Exit Sub

'Errorhandler RappCopyPic
ErrorHandler:
MsgBox prompt:="Unexpected error (errorkod " & Str$(Err.Number) & ") " & _
"take place in Sub CreatePicsHideCharts initiated by ws_activate in Report
Sheet" & vbCrLf _
& "Error description: " & Err.Description, _
Buttons:=vbCritical + vbMsgBoxHelpButton, _
Title:="Error!", _
HelpFile:=Err.HelpFile, _
Context:=Err.HelpContext
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub

About the name of the sheet: I always use the CodeName in the code

/Regards,


"Dave Peterson" skrev i meddelandet
...
The only time I've seen Norman's suggestion fail was when there were lots
of
pictures on that worksheet. (You sure you wanted to use
worksheets(1)--maybe it
would be better like:

Worksheets("sheet1").Pictures.Visible = False

(change sheet1 to the correct name)

if it doesn't work, one workaround is to iterate through the pictures:

Dim myPict As Picture
For Each myPict In ActiveSheet.Pictures
myPict.Visible = True
Next myPict


Gunnar Johansson wrote:

Sorry,
That syntax doesn't work, that was just an example.

/Regards

"Norman Jones" skrev i meddelandet
...
Hi Gunnar,

Try changing:

Worksheet(1).pictures.visible = True

to:

Worksheets(1).Pictures.Visible = True


---
Regards,
Norman



"Gunnar Johansson" wrote in message
...
I have a vba code that has worked well for a while, but during some
changes all pictures become hidden when I run the code. I have searched
for a explanation and will contiune, but would need a quick and dirty
solution right now to just tell them in the end of the code like:
"Worksheet(1).pictures.visible = True" .

Of course is the above mentioned example not working, but it give the
idea of my needs. Probably the solutions is a for each..next solution
and
that's ok, of cource.

NOTE:
You have to separate it from the chartobjects also within the
worksheet
/

Reagrds






--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How select all pictures in a worksheet and make visible?

did you miss that Norman changed
Worksheet(1)
to
Worksheets(1)

adding an "s"

--
Regards,
Tom Ogilvy

"Gunnar Johansson" wrote in message
...
Sorry,
That syntax doesn't work, that was just an example.

/Regards

"Norman Jones" skrev i meddelandet
...
Hi Gunnar,

Try changing:

Worksheet(1).pictures.visible = True

to:

Worksheets(1).Pictures.Visible = True


---
Regards,
Norman



"Gunnar Johansson" wrote in message
...
I have a vba code that has worked well for a while, but during some
changes all pictures become hidden when I run the code. I have searched
for a explanation and will contiune, but would need a quick and dirty
solution right now to just tell them in the end of the code like:
"Worksheet(1).pictures.visible = True" .

Of course is the above mentioned example not working, but it give the
idea of my needs. Probably the solutions is a for each..next solution

and
that's ok, of cource.

NOTE:
You have to separate it from the chartobjects also within the worksheet
/

Reagrds









Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I make a drop down box visible within a worksheet? skittles_golf Excel Worksheet Functions 42 April 21st 23 02:59 PM
How do I assign pictures to be visible according to cell value? Abdul Excel Discussion (Misc queries) 3 October 16th 08 11:07 PM
Pictures don't stay visible SteveF Excel Discussion (Misc queries) 0 January 27th 06 01:16 PM
Select Visible Cells Only Apparently Excel Discussion (Misc queries) 2 January 29th 05 12:40 AM
better search: "make worksheet visible" christo Excel Discussion (Misc queries) 1 December 1st 04 12:20 AM


All times are GMT +1. The time now is 07:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"