PC Review


Reply
Thread Tools Rate Thread

ComboBoxes in VBA

 
 
Ronald Dodge
Guest
Posts: n/a
 
      24th Jul 2007
Windows XP, SP2
Excel 2002, SP3

Trying to create a variable to replicate the combobox within the userform,
but needs to have the same setup of properties as shown within the userform
itself.

MSForms.ComboBox has some of the properties of the actual combobox, but is
missing certain fields such as the "RowSource" property

MSForms.Control has some of the properties of the actual combobox, but is
missing certain properties such as the "BackColor" property

I don't like the idea of using the "Variant" or "Object" variable types for
when declaring the variable for this combobox representation. I would
rather avoid code type problems such as code declaring as the wrong type of
variable when in Run-Time mode.

I attempted at using the "Object Browser" to find what I was looking for,
but only confirms that I'm missing certain things and doesn't seem to be one
specific object type available to list all of the properties of the actual
combobox in use on the userform.

For now, I am using the Control one as the RowSource property must be used,
but like to also be able to have all properties included via the variable
object. From good programming practices, there shouldn't be 2 different
variables representing the same object to handle different things within the
same procedure.

Yes, this is using early binding so as Intellisense can kick into play among
other reasons.

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000


 
Reply With Quote
 
 
 
 
Jim Rech
Guest
Posts: n/a
 
      24th Jul 2007
Works for me...

Sub aa()
Dim x As ComboBox
Set x = UserForm1.ComboBox1
MsgBox x.RowSource
End Sub


--
Jim
"Ronald Dodge" <(E-Mail Removed)> wrote in message
news:uH69%(E-Mail Removed)...
| Windows XP, SP2
| Excel 2002, SP3
|
| Trying to create a variable to replicate the combobox within the userform,
| but needs to have the same setup of properties as shown within the
userform
| itself.
|
| MSForms.ComboBox has some of the properties of the actual combobox, but is
| missing certain fields such as the "RowSource" property
|
| MSForms.Control has some of the properties of the actual combobox, but is
| missing certain properties such as the "BackColor" property
|
| I don't like the idea of using the "Variant" or "Object" variable types
for
| when declaring the variable for this combobox representation. I would
| rather avoid code type problems such as code declaring as the wrong type
of
| variable when in Run-Time mode.
|
| I attempted at using the "Object Browser" to find what I was looking for,
| but only confirms that I'm missing certain things and doesn't seem to be
one
| specific object type available to list all of the properties of the actual
| combobox in use on the userform.
|
| For now, I am using the Control one as the RowSource property must be
used,
| but like to also be able to have all properties included via the variable
| object. From good programming practices, there shouldn't be 2 different
| variables representing the same object to handle different things within
the
| same procedure.
|
| Yes, this is using early binding so as Intellisense can kick into play
among
| other reasons.
|
| --
|
| Sincerely,
|
| Ronald R. Dodge, Jr.
| Master MOUS 2000
|
|


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      24th Jul 2007
I built a userform with a combobox and a commandbutton. This was the code
behind the userform:

Option Explicit
Private Sub CommandButton1_Click()
Dim CBX As MSForms.ComboBox
Set CBX = Me.ComboBox1
MsgBox CBX.RowSource
End Sub
Private Sub UserForm_Initialize()
Me.ComboBox1.RowSource _
= Worksheets("sheet1").Range("a1:a10").Address(external:=True)
End Sub

It seemed to work ok for me.


Ronald Dodge wrote:
>
> Windows XP, SP2
> Excel 2002, SP3
>
> Trying to create a variable to replicate the combobox within the userform,
> but needs to have the same setup of properties as shown within the userform
> itself.
>
> MSForms.ComboBox has some of the properties of the actual combobox, but is
> missing certain fields such as the "RowSource" property
>
> MSForms.Control has some of the properties of the actual combobox, but is
> missing certain properties such as the "BackColor" property
>
> I don't like the idea of using the "Variant" or "Object" variable types for
> when declaring the variable for this combobox representation. I would
> rather avoid code type problems such as code declaring as the wrong type of
> variable when in Run-Time mode.
>
> I attempted at using the "Object Browser" to find what I was looking for,
> but only confirms that I'm missing certain things and doesn't seem to be one
> specific object type available to list all of the properties of the actual
> combobox in use on the userform.
>
> For now, I am using the Control one as the RowSource property must be used,
> but like to also be able to have all properties included via the variable
> object. From good programming practices, there shouldn't be 2 different
> variables representing the same object to handle different things within the
> same procedure.
>
> Yes, this is using early binding so as Intellisense can kick into play among
> other reasons.
>
> --
>
> Sincerely,
>
> Ronald R. Dodge, Jr.
> Master MOUS 2000


--

Dave Peterson
 
Reply With Quote
 
Ronald Dodge
Guest
Posts: n/a
 
      24th Jul 2007
Why then does this not show up in the Intellisense or within the Object
Browser?

--

Sincerely,

Ronald R. Dodge, Jr.
Master MOUS 2000

"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I built a userform with a combobox and a commandbutton. This was the code
> behind the userform:
>
> Option Explicit
> Private Sub CommandButton1_Click()
> Dim CBX As MSForms.ComboBox
> Set CBX = Me.ComboBox1
> MsgBox CBX.RowSource
> End Sub
> Private Sub UserForm_Initialize()
> Me.ComboBox1.RowSource _
> = Worksheets("sheet1").Range("a1:a10").Address(external:=True)
> End Sub
>
> It seemed to work ok for me.
>
>
> Ronald Dodge wrote:
>>
>> Windows XP, SP2
>> Excel 2002, SP3
>>
>> Trying to create a variable to replicate the combobox within the
>> userform,
>> but needs to have the same setup of properties as shown within the
>> userform
>> itself.
>>
>> MSForms.ComboBox has some of the properties of the actual combobox, but
>> is
>> missing certain fields such as the "RowSource" property
>>
>> MSForms.Control has some of the properties of the actual combobox, but is
>> missing certain properties such as the "BackColor" property
>>
>> I don't like the idea of using the "Variant" or "Object" variable types
>> for
>> when declaring the variable for this combobox representation. I would
>> rather avoid code type problems such as code declaring as the wrong type
>> of
>> variable when in Run-Time mode.
>>
>> I attempted at using the "Object Browser" to find what I was looking for,
>> but only confirms that I'm missing certain things and doesn't seem to be
>> one
>> specific object type available to list all of the properties of the
>> actual
>> combobox in use on the userform.
>>
>> For now, I am using the Control one as the RowSource property must be
>> used,
>> but like to also be able to have all properties included via the variable
>> object. From good programming practices, there shouldn't be 2 different
>> variables representing the same object to handle different things within
>> the
>> same procedure.
>>
>> Yes, this is using early binding so as Intellisense can kick into play
>> among
>> other reasons.
>>
>> --
>>
>> Sincerely,
>>
>> Ronald R. Dodge, Jr.
>> Master MOUS 2000

>
> --
>
> Dave Peterson



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      25th Jul 2007
I don't know.

Ronald Dodge wrote:
>
> Why then does this not show up in the Intellisense or within the Object
> Browser?
>
> --
>
> Sincerely,
>
> Ronald R. Dodge, Jr.
> Master MOUS 2000
>
> "Dave Peterson" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I built a userform with a combobox and a commandbutton. This was the code
> > behind the userform:
> >
> > Option Explicit
> > Private Sub CommandButton1_Click()
> > Dim CBX As MSForms.ComboBox
> > Set CBX = Me.ComboBox1
> > MsgBox CBX.RowSource
> > End Sub
> > Private Sub UserForm_Initialize()
> > Me.ComboBox1.RowSource _
> > = Worksheets("sheet1").Range("a1:a10").Address(external:=True)
> > End Sub
> >
> > It seemed to work ok for me.
> >
> >
> > Ronald Dodge wrote:
> >>
> >> Windows XP, SP2
> >> Excel 2002, SP3
> >>
> >> Trying to create a variable to replicate the combobox within the
> >> userform,
> >> but needs to have the same setup of properties as shown within the
> >> userform
> >> itself.
> >>
> >> MSForms.ComboBox has some of the properties of the actual combobox, but
> >> is
> >> missing certain fields such as the "RowSource" property
> >>
> >> MSForms.Control has some of the properties of the actual combobox, but is
> >> missing certain properties such as the "BackColor" property
> >>
> >> I don't like the idea of using the "Variant" or "Object" variable types
> >> for
> >> when declaring the variable for this combobox representation. I would
> >> rather avoid code type problems such as code declaring as the wrong type
> >> of
> >> variable when in Run-Time mode.
> >>
> >> I attempted at using the "Object Browser" to find what I was looking for,
> >> but only confirms that I'm missing certain things and doesn't seem to be
> >> one
> >> specific object type available to list all of the properties of the
> >> actual
> >> combobox in use on the userform.
> >>
> >> For now, I am using the Control one as the RowSource property must be
> >> used,
> >> but like to also be able to have all properties included via the variable
> >> object. From good programming practices, there shouldn't be 2 different
> >> variables representing the same object to handle different things within
> >> the
> >> same procedure.
> >>
> >> Yes, this is using early binding so as Intellisense can kick into play
> >> among
> >> other reasons.
> >>
> >> --
> >>
> >> Sincerely,
> >>
> >> Ronald R. Dodge, Jr.
> >> Master MOUS 2000

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
COMBOBOXES Zigball Microsoft Excel Programming 1 19th Dec 2006 01:10 AM
3 COMBOBOXES =?Utf-8?B?c21pbGV5?= Microsoft Excel Crashes 0 10th Oct 2005 05:12 PM
Comboboxes =?Utf-8?B?RGFycmVu?= Microsoft Excel Programming 1 23rd Jan 2005 05:35 PM
ComboBoxes in vb.net Ryan McConnell Microsoft VB .NET 2 25th Feb 2004 08:34 AM
ComboBoxes =?Utf-8?B?QmlsbA==?= Microsoft VB .NET 0 20th Feb 2004 03:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.