ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating User Forms (https://www.excelbanter.com/excel-programming/412601-creating-user-forms.html)

wutzke

Creating User Forms
 
Is there a way to create a user form programically?
If I had values in a row (item 1, item2, item3, ...)
and values in the next row representing quantities
can VB create a user form dynamically from these cells?

Jim Rech[_2_]

Creating User Forms
 
The VBE is programable so, yes, you could create a userform in the VBE.
You'd set a reference to Microsoft Visual Basic for Application
Extensibility 5.3 and start with code like this:

ActiveWorkbook.VBProject.VBComponents.Add vbext_ct_MSForm

You'd have to set "Trust access to Visual Basic Project" on under Tools,
Macro, Security _in Excel_ before this code will be allowed to run. (Macro
virus protection).

However I don't know why you'd want to do that. The better way is to create
the userform via the designer in the VBE and add the stock controls you'll
need. Then during the Initialize event your code can customize its
appearance dynamically using, if you want, variables in the sheet.

--
Jim
"wutzke" wrote in message
...
Is there a way to create a user form programically?
If I had values in a row (item 1, item2, item3, ...)
and values in the next row representing quantities
can VB create a user form dynamically from these cells?




wutzke

Creating User Forms
 
Thanks



All times are GMT +1. The time now is 07:40 AM.

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