Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default ComboBoxes in VBA

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBoxes in VBA

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(exter nal:=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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default ComboBoxes in VBA

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" wrote in message
...
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(exter nal:=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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default ComboBoxes in VBA

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" wrote in message
...
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(exter nal:=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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default ComboBoxes in VBA

Works for me...

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


--
Jim
"Ronald Dodge" wrote in message
...
| 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
comboboxes Zaahir Excel Programming 1 October 27th 06 02:43 PM
ComboBoxes Zaahir Excel Programming 0 October 19th 06 02:16 PM
comboboxes lgbjr Excel Programming 8 June 1st 05 06:52 AM
ComboBoxes Ryan Excel Programming 0 April 14th 04 10:56 PM
Comboboxes Angeliki Excel Programming 1 March 3rd 04 12:00 PM


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"