Creating User Forms

  • Thread starter Thread starter wutzke
  • Start date Start date
W

wutzke

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?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top