Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I was under the impression that you can add controls to a userform during
runtime and save the form with the new controls. If so I thought you could create a text box which isn't visible to the user and store (in a primitive fashion) some data in that. Could user "Designer" from within the same project to make persistent changes, but not AFAIK while the form is loaded, eg: Sub FormStuff() 'in a normal module Dim oCtrl As Control With ThisWorkbook.VBProject.VBComponents("UserForm1").D esigner 'create a new control Set oCtrl = .Controls.Add("Forms.Textbox.1") oCtrl.Value = "new textbox" 'oCtrl.Visible = False 'change other attributes to oCtrl.whatever 'CommandButton1 already exists ..CommandButton1.Caption = "last designed : " & Now End With End Sub Havn't tried but might be possible while the form is loaded to keep variables at global level, run "FormStuff" with OnTime as the form is unloaded, and put the variables back into controls, text, tag etc. maybe between the "With's" ..listbox1.list = [myArray] Regards, Peter "Nick Shinkins" wrote in message ... Oh, I could be wrong here. I was under the impression that you can add controls to a userform during runtime and save the form with the new controls. If so I thought you could create a text box which isn't visible to the user and store (in a primitive fashion) some data in that. I may well be wrong about saving the userform during runtime. If so, sorry. Nick Shinkins "Bob Phillips" wrote: and how is that data preserved when the for is unloaded? -- HTH RP (remove nothere from the email address if mailing direct) "Nick Shinkins" wrote in message ... Actually it is possible but it is silly and requires a lot of coding. All you need to do is create a non visible textbox on the fly on the form you are using. Then just fill it with the data you want to save. However you will need to write a procedure that can write to and correctly retrieve data stored in the text box. "Darren" wrote: I have a similar question to that what Dave made earlier.... I want to be able to have a userform, with comboboxes, textboxes etc, and hold the values that are entered within the form / code and not by setting the control source to a worksheet. The simple reason is that I dont want to have a seperate sheet, that has to be hidden, and protected by workbook protection passwords etc. It would be better to hold it all within the VBA, and just protect the VBA project. I want to be able to use the form on different reports, by importing the form and attached code. I have a feeling that this might not be possible, but can anyone help? Thanks, Darren |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Control on Form | Excel Discussion (Misc queries) | |||
2007 Form Control/ActiveX Control font difference | Excel Discussion (Misc queries) | |||
Tool Tip Text for Form control/ Active-X control | Excel Programming | |||
passing control value from one form to another form | Excel Programming | |||
#Holding values in different format# | Excel Programming |