ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving MSForm.Control (s) created at Runtime? (https://www.excelbanter.com/excel-programming/370501-saving-msform-control-s-created-runtime.html)

Post Tenebras Lux

Saving MSForm.Control (s) created at Runtime?
 
I have a CreateControl procedure behind a command button on an Excel
MSForms.Userform.

It creates various controls (combobox, textbox, checkbox, etc) in a row on
the form. This allows the user to add or delete and set any number of new
rows of control values.

I would like to be able to allow the user to Save the controls and all of
the properties (control.width; control.value; control.listrow, etc) that s/he
has created.

This way the next time the form is opened, the controls and their settings
don't have to be recreated - but can be added or substracted depending on
that session's requirements and usage of the form and it's underlying
procedures.

Is this possible and, if so, how?

Thanks.


NickHK

Saving MSForm.Control (s) created at Runtime?
 
Not sure if it will work, but if you export the form from the VBE whilst
it's running, you get a text file of all the setting. May be useful.
Otherwise, just run through the .Controls collection, saving each controls
properties, in some format, ini file, xml etc then read back when needed.
Need to be careful with frame etc that act as containers.

NickHK

"Post Tenebras Lux" wrote in
message ...
I have a CreateControl procedure behind a command button on an Excel
MSForms.Userform.

It creates various controls (combobox, textbox, checkbox, etc) in a row on
the form. This allows the user to add or delete and set any number of new
rows of control values.

I would like to be able to allow the user to Save the controls and all of
the properties (control.width; control.value; control.listrow, etc) that

s/he
has created.

This way the next time the form is opened, the controls and their settings
don't have to be recreated - but can be added or substracted depending on
that session's requirements and usage of the form and it's underlying
procedures.

Is this possible and, if so, how?

Thanks.





All times are GMT +1. The time now is 01:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com