Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to move 200 text boxes on a formula.
Instead of moving them by hand I have written some code behind a command button. For instance ____________________________________ Private Sub CommandButton1_Click() UserForm1.TextBox1.top = 10 UserForm1.TextBox1.width = 20 UserForm1.TextBox1.left = 10 End Sub ____________________________________ When I click the command box they move. But the next time I open the form they are back to the old postions. How do I get them to maintain the property I set with the button? Garry Jones Sweden |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tjena Garry
You have to save the settings somewhere and read them back on next load. Within the file, in another excel file, in a text file, in the registry, in an ini file, in a database, anywhere. Between sesions, this is. If it's only for the same session then some available variables will do. (But saving/restoring the user's last settings between sessions is a nice thing to do anyway). -- HTH. Best wishes Harald Followup to newsgroup only please. "Garry Jones" wrote in message ... I need to move 200 text boxes on a formula. Instead of moving them by hand I have written some code behind a command button. For instance ____________________________________ Private Sub CommandButton1_Click() UserForm1.TextBox1.top = 10 UserForm1.TextBox1.width = 20 UserForm1.TextBox1.left = 10 End Sub ____________________________________ When I click the command box they move. But the next time I open the form they are back to the old postions. How do I get them to maintain the property I set with the button? Garry Jones Sweden |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald Staff wrote:
You have to save the settings somewhere and read them back on next load. So I can't move text boxes by code? This is nothing to do with users, I have not released this yet, it's not ready. I am still in the design stage. I have a user form and on it I have 198 text boxes. I want to move them about a bit. Simplfying this to four boxes in this order textbox1 textbox2 textbox3 textbox4 (current postions) Textbox1, top=10, left=10 Textbox2, top=10, left=100 Textbox3, top=50, left=10 Textbox4, top=50, left=100 I want the following order textbox1 textbox3 textbox2 textbox4 I wish for textbox3 and textbox4 to change place. So I have prepared the code needed, with all the top, left and width positions. If I run UserForm1.TextBox2.top = 50 UserForm1.TextBox2.left = 10 UserForm1.TextBox3.top = 10 UserForm1.TextBox3.left = 100 They move when I run the code, but they do not stay there. How do I get them to stay there, I want a permanent update on the form. If it's only for the same session then some available variables will do. Garry Jones |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
"Garry Jones" wrote in message ...
Harald Staff wrote: You have to save the settings somewhere and read them back on next load. So I can't move text boxes by code? 'Course you can. You already have. They move when I run the code, but they do not stay there. How do I get them to stay there, I want a permanent update on the form. When do they stop staying ? What has happened between staying and not staying ? Thing is, when a form is unloaded, everything goes and it's back to how you initially built it and no smarter. If I understand your problem right, do some reading on the terms "design time" and "run time". Best wishes Harald |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Harald Staff wrote:
If I understand your problem right, do some reading on the terms "design time" and "run time". Yep, that's the one. I am in design time. I placed 198 text boxes in a formula. But I placed them in the wrong order. Now I thought I'd be smart (but failed) and move them in design with VB code. Of course I can grab them all one by one and move them by hand (mouse) and this would save me time today. However, in the (near) future I may want to move them around again until I am happy with their placement. And if I have the code syntax I'll just have to enter the new required values. So what I am looking for is a feature to move text boxes around within a userform whilst still in design stage. And when that is done, "save current changes to userform appearance". Ěs there a workaround for this? As far as reading goes my tasks seem to be too advanced for the simple books I have and too simple for my complex books. I have been sucessful in finding a few answers on "exceltips.com" and with Google. I don't want to overdo questioning this newsgroup as I have little to input at the moment. I do, however, believe in a solidarity in news and often answer or try to help people in other newsgroups which are nearer my own expertise. (I've been in computers since 1979 when I started out as a mainframe operator in London, happy memories of 2540 card readers, punch output and paper tape input). I am greatful for you sharing your time and answering me. Thanks! Garry Jones |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi again
No, that's pretty impossible. But when you way "wrong order", does that apply to bound spreadsheet cells or simply Tab order ? The latter is fixed by rightclicking the form in design time and adjusting the list. Also, a userform has an event called Private Sub UserForm_Initialize() code here runs before the form is loaded/displayed, and would be the ideal place to put your existing "move boxes" code. I guess/hope this is the workaround you look for. Put this in the Userform module, nowhere else: Private Sub UserForm_Initialize() TextBox2.top = 50 TextBox2.left = 10 TextBox3.top = 10 TextBox3.left = 100 End Sub -- HTH. Best wishes Harald Followup to newsgroup only please. "Garry Jones" wrote in message ... Harald Staff wrote: If I understand your problem right, do some reading on the terms "design time" and "run time". Yep, that's the one. I am in design time. I placed 198 text boxes in a formula. But I placed them in the wrong order. Now I thought I'd be smart (but failed) and move them in design with VB code. Of course I can grab them all one by one and move them by hand (mouse) and this would save me time today. However, in the (near) future I may want to move them around again until I am happy with their placement. And if I have the code syntax I'll just have to enter the new required values. So what I am looking for is a feature to move text boxes around within a userform whilst still in design stage. And when that is done, "save current changes to userform appearance". Ěs there a workaround for this? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculate Textbox value based on another textbox value.doc | Excel Discussion (Misc queries) | |||
Calculate Textbox value based on another textbox value | Excel Discussion (Misc queries) | |||
data range props | Excel Discussion (Misc queries) | |||
Textbox | Excel Discussion (Misc queries) | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming |