Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default control gif with VB

Hi!

I have three gif-objects (three smilies, one green, one yellow, one red)
which build a traffic light. Depending on the user interaction, I want to
display only one of the three smilies. Does anybody know, how I can handle
this problem. Is it possible to control gifs with VB, I mean control their
state (displayed/ not displayed) or is there something like a canvas, which
can contain a gif?

Thanks a lot for your answers.

Regards
Christian


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default control gif with VB

Hi Christian,

Christian Galbavy wrote:
I have three gif-objects (three smilies, one green, one yellow, one
red) which build a traffic light. Depending on the user interaction,
I want to display only one of the three smilies. Does anybody know,
how I can handle this problem. Is it possible to control gifs with
VB, I mean control their state (displayed/ not displayed) or is there
something like a canvas, which can contain a gif?


Are you referring to GIFs on a worksheet? If so, you can use the Shapes
collection to get at the images via VBA. Here's the setup:

1) Insert each GIF using Insert | Picture -- From File...

2) Name them picGreen, picYellow, and picRed (after selecting one, you can
use the Name box in the toolbar to rename it)

Now, you can show/hide them as follows:

Public Enum eLightColor
Green = 1
Yellow = 2
Red = 3
End Enum

Public Sub gChangeLight(rlColor As eLightColor)
With Sheets("Sheet1")
If rlColor = eLightColor.Green Then
.Shapes("picGreen").Visible = msoTrue
.Shapes("picYellow").Visible = msoFalse
.Shapes("picRed").Visible = msoFalse
ElseIf rlColor = eLightColor.Yellow Then
.Shapes("picGreen").Visible = msoFalse
.Shapes("picYellow").Visible = msoTrue
.Shapes("picRed").Visible = msoFalse
Else
.Shapes("picGreen").Visible = msoFalse
.Shapes("picYellow").Visible = msoFalse
.Shapes("picRed").Visible = msoTrue
End If
End With
End Sub

'/ make the light green
gChangeLight eLightColor.Green

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


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
Process control chart for quality control in exel? Kara Charts and Charting in Excel 2 May 11th 10 05:45 PM
2007 Form Control/ActiveX Control font difference Nikko963 Excel Discussion (Misc queries) 0 April 15th 09 04:21 PM
Difference between a Forms Control verus Active-X Control funGT350 Excel Discussion (Misc queries) 6 May 6th 08 11:20 PM
Tool Tip Text for Form control/ Active-X control Freddie[_2_] Excel Programming 0 October 19th 04 04:14 AM
Calendar Control: Can't exit design mode because control can't be created Rone Excel Programming 0 May 24th 04 04:01 PM


All times are GMT +1. The time now is 07:47 AM.

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"