Modify excel userform controls through vbproject?

D

daithimcc

(Excel vX for Macintosh)
Does anyone know if it is possible to set properties of controls on an
excel userform using the vbproject. I know I can set the textbox
heights etc... at run-time, but as there are many changes I want to
make to many controls I wonder if there is any quick way of doing this
in the VB editor (without using the normal interface, which would be
quite slow).
I can get the userform as a vbcomponent using
thisworkbook.vbproject.vbcomponents("formname") but I can't seem to do
what I want with this. Is there any way of returning the userform
object via the vbproject?
Thanks
David
 
C

Chip Pearson

David,

You need to use the Designer object of the form. For example, the
following will set the height of CommandButton1 to 48.

With ThisWorkbook.VBProject.VBComponents("UserForm1").Designer
.Controls("CommandButton1").Height = 48
End With

I have no idea is this will work on a Macintosh.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
D

daithimcc

Yes this works on the Macintosh. Thanks a lot - it does the job
perfectly. Is there a source you can recommend covering all of these
more obscure features?
Thanks again.
David
 

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

Top