animate autoshapes
Is it possible to animate an object when a workbook
opens. I would like to create an autoshape (an arrow) and when the workbook is opened, I would like to have the arrow flash on and off or change colors, etc. Something to grab the users attention. Is this possible? Any help with the code would be appreciated. Thanks. |
animate autoshapes
Here are two subs - one that flashes a shape, the other cycles the fill
color. For the "Set MyShape = " use the name of the autoshape as it appears in the Name Box on the Excel toolbar when you have it selected. You can adjust the number of cycles as needed, or the other particulars. I have set the color cycle to random colors, but you could use a predefined set if you modify the code. To run when opening the book, set one of these to be your Workbook_Open event procedu Public Sub FlashShape() Dim MyShape As Object, EndTime As Date, Cycle As Integer Set MyShape = Sheets("Sheet1").Shapes("Autoshape 1") For Cycle = 1 To 5 MyShape.Visible = False EndTime = Timer + 0.2 While EndTime Timer DoEvents Wend MyShape.Visible = True EndTime = Timer + 0.2 While EndTime Timer DoEvents Wend Next Cycle End Sub Public Sub ColorCycle() Dim MyShape As Object, EndTime As Date, Cycle As Integer Dim RVal As Integer, GVal As Integer, BVal As Integer Set MyShape = Sheets("Sheet1").Shapes("Autoshape 1") Randomize For Cycle = 1 To 5 RVal = Int(Rnd * 256) GVal = Int(Rnd * 256) BVal = Int(Rnd * 256) MyShape.Fill.ForeColor.RGB = RGB(RVal, GVal, BVal) EndTime = Timer + 0.5 While EndTime Timer DoEvents Wend Next Cycle End Sub "JT" wrote: Is it possible to animate an object when a workbook opens. I would like to create an autoshape (an arrow) and when the workbook is opened, I would like to have the arrow flash on and off or change colors, etc. Something to grab the users attention. Is this possible? Any help with the code would be appreciated. Thanks. |
All times are GMT +1. The time now is 02:15 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com