Listbox autosize?

J

John Keith

I have a form named PickAMonth with a listbox control named lstMonthlyTabs.
I am assigning an array to the List property which works fine, but the next
two lines cause errors...

PickAMonth.lstMonthlyTabs.List = vaWksNames
PickAMonth.lstMonthlyTabs.AutoSize True
PickAMonth.AutoSize True

Tried them both with = or := to set the true value but I still get the
error: Method or data member not found; the ".AutoSize" is highlited when
the error is produced. This is a form created inside the VB editor (not the
forms toolbar from excel)

I am running Office2003 using excel's VBA to control the form.
How do I automatically size my listbox and form to match the data size?
 
J

JLGWhiz

The correct syntax for the AutoSize is :
myObject.AutoSize = True

However, it looks as though MS chose not to include the ListBox as one of
the objects that the AutoSize property would apply to. You will have to use
Height and Width to size the ListBox.
 

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