Gruppe
Grafik
Bereich
Animation
Thema
Animation in Excel
Problem
Wie kann ich in Excel bewegte Objekte erstellen?
Lösung
Geben Sie den nachfolgenden Code in ein Standardmodul ein und weisen Sie ihn den Zeichnungselementen zu.
StandardModule: mHWH
Declare Sub Sleep Lib "kernel32" _
(ByVal dwMilliseconds As Long)
Sub Start()
Dim oHWH As Shape
Dim iCounter As Integer
Set oHWH = ActiveSheet.Shapes("HWH")
oHWH.Rotation = 0
Do Until iCounter = 360
oHWH.IncrementRotation 2
Sleep 10
DoEvents
iCounter = iCounter + 2
Loop
oHWH.Rotation = 0
End Sub
Sub DM2Euro()
Dim oEURO As Shape, oDM As Shape
Set oEURO = ActiveSheet.Shapes("Euro")
Set oDM = ActiveSheet.Shapes("DM")
Dim iCounter As Integer, iCount As Integer
oDM.Visible = True
With oEURO
.Top = 400
.Left = 5
.Height = 41.25
.Width = 36.75
.Rotation = 0
oEURO.Visible = True
Do Until .Left >= 500 Or .Top <= 50
.IncrementRotation 15
.Left = .Left + 5
.Top = .Top - 4
Sleep 100
DoEvents
Loop
.Width = 180
.Height = 180
.Top = 20
.Left = 450
.Rotation = 0
End With
ActiveSheet.Shapes("DM").Visible = False
End Sub