Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Hiding objects based on property of object

I have a flowchart built out of a number of shapes in my Excel
worksheet. I want to write a macro to hide a number of objects based
on a shape property. For example, I want to hide all objects with a
certain transparency, or a certain color.

I am making a presenation and I want to hide portions of it at the
click of a mouse.

Any suggestions?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Hiding objects based on property of object

Bert,
Not sure if Excel is the best for this. PowerPoint ?
Anyway something like this, with whatever your objects and properties are,
should get you started:

Private Sub CommandButton1_Click()
Dim Shapeobj As Shape

'Loop through all the shapes on the sheet
For Each Shapeobj In ThisWorkbook.ActiveSheet.Shapes
With Shapeobj
Select Case .AutoShapeType
'Decide which type of object tests which property for visibilty
Case msoShapeFlowchartDecision
.Visible = (.Width 10)
Case msoShapeFlowchartConnector
.Visible = (.Height 20)
'.
'.
'.

Case Else
.Visible = True
End Select
End With
Next

End Sub


"Bert" wrote in message
om...
I have a flowchart built out of a number of shapes in my Excel
worksheet. I want to write a macro to hide a number of objects based
on a shape property. For example, I want to hide all objects with a
certain transparency, or a certain color.

I am making a presenation and I want to hide portions of it at the
click of a mouse.

Any suggestions?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Hiding objects based on property of object

Put a few rectangles and ovals on a sheet..
then try s'th like this:

Sub PeekaBoo(Visibility As Boolean, _
Optional ws As Worksheet, _
Optional ShapeType As MsoAutoShapeType = -1, _
Optional fTrans As Double = -1)
Dim sh As Shape

If ws Is Nothing Then Set ws = ActiveSheet

Application.ScreenUpdating = False

If ShapeType = -1 And fTrans = -1 Then
For Each sh In ws.Shapes
sh.Visible = Visibility
Next
ElseIf ShapeType = -1 Then
For Each sh In ws.Shapes
If Abs(sh.Fill.Transparency - fTrans) < 0.05 Then
sh.Visible = Visibility
End If
Next
ElseIf fTrans = -1 Then
For Each sh In ws.Shapes
If sh.AutoShapeType = ShapeType Then
sh.Visible = Visibility
End If
Next
Else
For Each sh In ws.Shapes
If Abs( _
sh.Fill.Transparency - fTrans) < 0.05 And _
sh.AutoShapeType = ShapeType Then
sh.Visible = Visibility
End If
Next
End If

Application.ScreenUpdating = True

End Sub

Sub Test()

Call PeekaBoo(True)
Call PeekaBoo(False, , , 0.3)
Application.Wait Now + TimeSerial(0, 0, 5)
Call PeekaBoo(True)
Call PeekaBoo(False, , msoShapeRectangle)
Application.Wait Now + TimeSerial(0, 0, 5)
Call PeekaBoo(True)
Call PeekaBoo(False, , msoShapeRectangle, 0.3)
Application.Wait Now + TimeSerial(0, 0, 5)
Call PeekaBoo(True)

End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(Bert) wrote:

I have a flowchart built out of a number of shapes in my Excel
worksheet. I want to write a macro to hide a number of objects based
on a shape property. For example, I want to hide all objects with a
certain transparency, or a certain color.

I am making a presenation and I want to hide portions of it at the
click of a mouse.

Any suggestions?

Thanks


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
Lookin property of the FileSearch object [email protected] New Users to Excel 0 December 5th 06 09:37 PM
Get objects property names in run-time? Tom Ogilvy Excel Programming 0 February 13th 04 12:43 PM
Page Object property Matt[_18_] Excel Programming 1 October 2nd 03 01:43 PM


All times are GMT +1. The time now is 01:32 PM.

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

About Us

"It's about Microsoft Excel"