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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to put a command button and

Status
Not open for further replies.

bnageshrao

Programmer
Mar 17, 2001
83
US
I want to put a command button and write a code for that. If user tries to click on that button it should keep moving and should not allow them to click on it. If you know the code handy please send it to me. I had it long time ago but then lost it. Thanks
 
All you do here is create 2 random numbers that do not exceed the screen size.
On the mouseover event of your button, redraw the form in a different position on the screen using the .top and .left properties.

Eradic8or
 
I used mousemove property for the command button and wrote the following code which for some reason doesnot work in VBA and I get some error message. How to write your code?

cmdPress.Move _
Rnd * (Scalewidth - cmdPress.Width), _
Rnd * (ScaleHeight - cmdPress.Height)


 
Try using

cmdPress.Move _
Rnd * (Me.Width - cmdPress.Width), _
Rnd * (Me.Height - cmdPress.Height)

Me is the active form where scale may imply the acitve window or your desktop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top