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

I put a command button on the sprea

Status
Not open for further replies.

bnageshrao

Programmer
Mar 17, 2001
83
US
I put a command button on the spreadsheet and wrote the fPrivate

Sub cmdPress_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

cmdPress.Move _
Rnd * (ScaleWidth - cmdPress.Width), _
Rnd * (ScaleHeight - cmdPress.Height)
End Subollowing code

When I click on the button I get Run time error 438 - Object doesnot support this method or property. Same code works fine in Regular VB. What should be done to make it work in VBA.
 
JohnYingling is correct there is no .Move.

You need to use:

.Top and .Left to position the Button.

Eg something like this:

CmdPress.Top = Rnd * (ScaleHeight - cmdPress.Height)
CmdPress.Left = Rnd * (ScaleWidth - cmdPress.Width)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top