View Full Version : moving textboxes/labels through vba?


Espinoza84
06-17-2008, 06:21 AM
Through the help and suggestion of this board users, I have a CASE driven code for my report I am working on. I am hiding/showing (visible=true/false) some textboxes/labels.

Now, I am wondering if I can also move textboxes/labels through vba coding?
For example, What would be the syntax to move "Text5"; 3 spots to the left, or 3 clicks to the left or whatever it is called?

Is it even possible?

Thanks in advance.

pbaldy
06-17-2008, 06:30 AM
I think you can move it by changing it's Left and Top properties. I've never actually needed it.

KenHigg
06-17-2008, 06:56 AM
And I think the units are twips - ?

Espinoza84
06-17-2008, 07:04 AM
Text6.Left = 2773

Cool thanks!

now to play around with the twips number lol

ah guessing time I guess ;o

edit: actually there is 1440 twips in 1 inch, and lucky the property box of any label/textbox tells me their position in inches, so it should not be too hard.

thanks all.

boblarson
06-17-2008, 07:17 AM
Text6.Left = 2773

Cool thanks!

now to play around with the twips number lol

ah guessing time I guess ;o

edit: actually there is 1440 twips in 1 inch, and lucky the property box of any label/textbox tells me their position in inches, so it should not be too hard.

thanks all.

Yeah, I never convert them anymore. I just use the inches measurement and multiply:

Me.MyTextBox.Left = 3.58 * 1440

Espinoza84
06-17-2008, 08:24 AM
I have a line I am trying to move through vba:

CASE "ECO"
.line26.left = 60
.ine26.width = 10980 'This code works, my line displays fine

This code does not work:

CASE "LAN"
.Line26.Left = 1140
.Line26.Width = 9900 'notice i reduced the width so that it fits in the same page. Even if I reduce the width to like 5900 the code does not run.

Any idea why?