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

Move objects on a form with VBA

Status
Not open for further replies.

genxiii

Technical User
Jun 13, 2003
17
US
Hey guys, i'm trying to figure out how you can move an object to a differnt position on a form using VBA. I don't want to use .Left =(position on screen) and designate the exact location where the object should be. I want to subtract or add a certain twip distance from/to an object's current location to move it to a new position on the form using VBA. Any help would be great. thanks
 
Hi!

You can use .Left = .Left +- #ofTwipstoMove. You will probably want to run a check to make sure you aren't trying to move the control off of the form.

hth


Jeff Bridgham
bridgham@purdue.edu
 
I placed an image control on a form. Called it img1.
I put a command button on the same form. Called it cmdMove.
In the command button's On Click event, I put...

Private Sub cmdMove_Click()
img1.Left = img1.Left + 100
End Sub

This moves my image 100 twips to the right each time I click it. I could put another button and put

img1.Left = img1.Left - 100

and this would bring it back to the left.

Hope that helps.



ProDev, MS Access Applications
Visit me at ==> Contact me at ==>lonniejohnson@prodev.us

May God bless you beyond your imagination!!!
 
Give a try to thread: thread702-580403
i haven't tested but I think that's might do what you want

jul ^_^
 
it worked, thanks a lot guys. i kinda figured that's how ur suppose to do it but i wasn't sure if you were just suppose to retype the control name on the other side of the = n jus add or subtract from it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top