Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I Hide/Unhide picture with dropdown arrow ? 3

Status
Not open for further replies.

Recce

Programmer
Aug 28, 2002
425
ZA
Good day,

I have a few pictures in a Excel spread sheet underneath each other. I would like to know if it is possible to hide the individually by clicking on a dropdown arrow or anything similar ?

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
There is no criteria. I would just like to put a dropdown arrow next to every picture so that when I click on th arrow the pic disappear and when I click on it again it will appear/ungrouped again. The reason for this is that if I have many pics underneath each other I can only click the arrows and all the pics will be imploded underneath each other. This will allow me for example to have a heading fro every pic and then implode all pics and have for example 5 or ten headings underneath each other. See below.

> Heading one
> Heading two

V (pic) 0-0
|
-
> Heading four

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 



"...and when I click on it again it will appear..."

Hmmmmmm, let's see. It's DISAPPEARED! So where IS it?

I can click on...... WHAT??? .... to make it appear??? NOTHING is there!!!!!!!

Skip,

[glasses] [red][/red]
[tongue]
 

I was thinking in terms of HIDING the row that the PIC is in.

How about this logic...
[tt]
If PIC is in selected cell then
CUT the pic and paste it in the corresponding row/col in a hidden sheet
else the cell is empty so...
cut the PIC on the hidden sheet and paste into selected cell
end
[/tt]



Skip,

[glasses] [red][/red]
[tongue]
 
Off the top of my head.....

How about putting them in an ActiveX image control? Clicking the cell resizes the control bigger (if it is small), or smaller (if it is big).

You can shrink a control down to a single pixel - well not really, it depends on your video driver, but you can get them virtually invisible.

This would answer the plaintive "where is it?" from Skip.

faq219-2884

Gerry
My paintings and sculpture
 





Ahhhhhh, Gerry, ya got me to thinkin'! DANGEROUS!!!
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim shp As Shape
    For Each shp In ActiveSheet.Shapes
        If shp.TopLeftCell.Address = Target.Address Then
            If shp.Visible Then
                shp.Visible = False
            Else
                shp.Visible = True
            End If
        End If
    Next
End Sub

Skip,

[glasses] [red][/red]
[tongue]
 
The 'Visible' property of the shape is one of those the UDF can change. You can add a custom function:
Code:
Public Function ShowHidePicture(PictureName As String, Visibility As Boolean)
ActiveSheet.Shapes(PictureName).Visible = Visibility
End Function

and apply in the sheet. Picture name and/or visibility can be set via data validation lists.

combo
 
Some very nice ideas you guys have here. Thanks for this. I'm busy playing around with this. Thx :)

[pipe] "We know nothing but, that what we know is not the truth..." - Me
 
No Skip, I did not state Visible. I was stated SIZE. I do this in Word - so I don't know what the effect is in Excel. I resize the control. I set its .Height and .Width properties. Like this:
Code:
Sub Image1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
   If Image1.Height = 361.6 Then
      With Image1
         .Height = 2
         .Width = 2
         .AutoSize = False
      End With
   Else
      With Image1
         .Height = 361.6
         .Width = 361.6
         .AutoSize = True
      End With
   End If
End Sub
I use the DoubleClick event, as I am using the _Click for something else.

Double-clicking makes it either 2 points (tiny), or its full size (361.6). You can play with "full" size with the AutoSize =True.

Essentially, this shrinks the image control to the size of a period. Double clicking it again, brings it back to full view.

Not .Visible.

One of the "cute" things I do is making image controls shrink to 4 points. This makes them look just like a square bullets. Really. Shrunk they look exactly like bullets. I then have text beside them, like text after a bullet. Double click the "bullet" and the image expands to the size I want, becomes centered on the page, with added text below it as a hyperlink to the source article.

Double click it again, and it shrinks, and becomes a "bullet" again, the hyperlink is removed, and the original indented text back where it was....a normal looking bulleted list. For example:
[ul square][li] Ring Nebula in Lyra[/li][li]Dumbbell Nebula in Vulpecula[/li][li]North America Nebula in Cygnus[/li][/ul]

Double-clicking the "bullet" expands the image control full size, centers it on the page, and creates a hyperlink to the accredited source of the photo below the image. Double click again..it collapses back to a bulleted list.

NOTE: you do have to play with the shrunk size. On my system 4 points works best to make them look exactly like bullets. This will of course be different depending on screen resolution. But a value of 3 - 6 works for the common resolutions.


faq219-2884

Gerry
My paintings and sculpture
 




Woooaaaaaa! Another great option!

I like the bullet like feature. One of the shortcomings of using the Visible property is that you can't see where the invisible shapes are.

Skip,

[glasses] [red][/red]
[tongue]
 
The reason the shrunk size looks like a square bullet is the borders essentially merge together. You could just as easily replace the image IN the control with a different, much smaller one - and use THAT as a "bullet".

Further, although this is a bit more work, if you have a solid fast Internet connection, you can use WinHTTP to LoadPicture the image dynamically. I use this for files on our Intranet. That way you can keep the Word file size down, as when you click the "bullet" the image control goes out and gets the image.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top