Moving an action button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to create an action button that moves away from the mouse
pointer. So if someone goes to click on it, it just keeps moving away so they
can;t click on it??
 
Yes, this could be done with VBA. You would have to create a macro to
move the button and have it launched on MouseOver. Something like this
might be what you want:

Sub MoveMe(oShp As Shape)
If oShp.Left + oShp.Width > _
ActivePresentation.PageSetup.SlideWidth Then
oShp.Left = 0
Else
oShp.Left = oShp.Left + oShp.Width
End If
End Sub

--David
--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
OK. I got a little carried away and was having too much fun with this. Try
this. Just assign the macro MoveMe to the Mouse Over action setting of the
button you want to have move out of the way. It will randomly move up, down,
left, or right each time the mouse goes over the button.

Sub RandomMove(oshp As Shape)
Dim rndNum As Integer

Randomize
rndNum = Int(4 * Rnd)
If rndNum = 0 Then
MoveMeRight oshp
ElseIf rndNum = 1 Then
MoveMeLeft oshp
ElseIf rndNum = 2 Then
MoveMeUp oshp
ElseIf rndNum = 3 Then
MoveMeDown oshp
End If
End Sub
Sub MoveMeRight(oshp As Shape)
If oshp.Left + oshp.Width + 5 > _
ActivePresentation.PageSetup.SlideWidth Then
oshp.Left = 0
Else
oshp.Left = oshp.Left + oshp.Width + 5
End If
End Sub
Sub MoveMeLeft(oshp As Shape)
If oshp.Left - oshp.Width - 5 < 0 Then
oshp.Left = ActivePresentation.PageSetup.SlideWidth - oshp.Width
Else
oshp.Left = oshp.Left - oshp.Width - 5
End If
End Sub
Sub MoveMeDown(oshp As Shape)
If oshp.Top + oshp.Height + 5 > _
ActivePresentation.PageSetup.SlideHeight Then
oshp.Top = 0
Else
oshp.Top = oshp.Top + oshp.Height + 5
End If
End Sub
Sub MoveMeUp(oshp As Shape)
If oshp.Top - oshp.Height - 5 < 0 Then
oshp.Top = ActivePresentation.PageSetup.SlideHeight - oshp.Height
Else
oshp.Top = oshp.Top - oshp.Height - 5
End If
End Sub
 
You're welcome. Thanks for getting back to us that it is what you wanted.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
Back
Top