Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Locking down a combobox

Is there a way to allow a combobox entry to be selected from a list, but to
disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Locking down a combobox

Ian,

A Listbox is the solution. What do you mean "I want the drop-down to
appear" ? A Listbox will show the dropdown list.

Please elaborate.

MB

"IanC" wrote in message news:bU_Un.51524$k15.28828@hurricane...
Is there a way to allow a combobox entry to be selected from a list, but
to disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Locking down a combobox

Hi MerseyBeat

Thanks for the quick response.

As far as I understand it, you can scroll up/down through the contents of
the list in a listbox, but there's no way to display the whole list to click
on an entry without expanding the size of the listbox. A combobox has a
drop-down arrow to the right of the text area which does this.

In the help for ListBox Control it says "You can't drop text into a
drop-down ListBox" but I can't find any way to make it drop down.

Using Excel 2000.

--
Ian
--

"MerseyBeat" wrote in message
...
Ian,

A Listbox is the solution. What do you mean "I want the drop-down to
appear" ? A Listbox will show the dropdown list.

Please elaborate.

MB

"IanC" wrote in message
news:bU_Un.51524$k15.28828@hurricane...
Is there a way to allow a combobox entry to be selected from a list, but
to disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--







  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Locking down a combobox

Is this a combobox from the Control toolbox toolbar (if it's on a a worksheet)
or a combobox on a userform (inside the VBE)?

If yes, then look at the .Style property of that combobox.



On 06/25/2010 04:44, IanC wrote:
Is there a way to allow a combobox entry to be selected from a list, but to
disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--



--
Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Locking down a combobox

Thanks Dave. fmStyleDropDownList appears to be just what I needed.

The only drawback is that I need to rewrite some of my code. When I select
this, the Text property becomes invalid. I currently have "Select" appearing
in each ComboBox to prompt the user and some code that looks for the absence
of this to enable a command button (ie each ComboBox must have an option
selected for the OK button to be enabled).

I'm sure I'll find a way round it.

--
Ian
--

"Dave Peterson" wrote in message
...
Is this a combobox from the Control toolbox toolbar (if it's on a a
worksheet) or a combobox on a userform (inside the VBE)?

If yes, then look at the .Style property of that combobox.



On 06/25/2010 04:44, IanC wrote:
Is there a way to allow a combobox entry to be selected from a list, but
to
disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--



--
Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Locking down a combobox

I've never seen that .text property break using this.

You may want to try again or post more details.



On 06/25/2010 06:28, IanC wrote:
Thanks Dave. fmStyleDropDownList appears to be just what I needed.

The only drawback is that I need to rewrite some of my code. When I select
this, the Text property becomes invalid. I currently have "Select" appearing
in each ComboBox to prompt the user and some code that looks for the absence
of this to enable a command button (ie each ComboBox must have an option
selected for the OK button to be enabled).

I'm sure I'll find a way round it.

--
Ian
--

"Dave wrote in message
...
Is this a combobox from the Control toolbox toolbar (if it's on a a
worksheet) or a combobox on a userform (inside the VBE)?

If yes, then look at the .Style property of that combobox.



On 06/25/2010 04:44, IanC wrote:
Is there a way to allow a combobox entry to be selected from a list, but
to
disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--



--
Dave Peterson




--
Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 157
Default Locking down a combobox

Hi Dave

I'm not trying to change the Text property in code, but in the Properties
box in VBE.

Initailly, I had
Style = 0 - fmStyleDropDownCombo
Text = Select

When I changed Style to 2 - fmStyleDropDownList, Text automatically cleared.
Now when I try to enter something in Text, I get "Could not set the Text
property. Invalid property value."

If I copy/paste an entry from the list this is accepted, but if I try to
type anything in (even something in the list) I get the same failure.
MatchEntry is set to 2 - fmMatchEntryNone and MatchRequired is set to False.

Any ideas?

I think I've figured out a workaround for my code if I have to change it. As
an alternative to looking for the absence of "Select" with...
If Me.ComboBox1.Text = "Select" Then Me.CommandButton1.Enabled = False
I think I can set MatchRequired to True, then check the MatchFound property
with ...
If Me.ComboBox1.MatchFound = True Then Me.CommandButton1.Enabled = False

That said, if I use MatchRequired/MatchFound and change my code to suit, I
don't need to change the ComboBox Style as invalid entries will result in
the OK button being disabled.

--
Ian
--

"Dave Peterson" wrote in message
...
I've never seen that .text property break using this.

You may want to try again or post more details.



On 06/25/2010 06:28, IanC wrote:
Thanks Dave. fmStyleDropDownList appears to be just what I needed.

The only drawback is that I need to rewrite some of my code. When I
select
this, the Text property becomes invalid. I currently have "Select"
appearing
in each ComboBox to prompt the user and some code that looks for the
absence
of this to enable a command button (ie each ComboBox must have an option
selected for the OK button to be enabled).

I'm sure I'll find a way round it.

--
Ian
--

"Dave wrote in message
...
Is this a combobox from the Control toolbox toolbar (if it's on a a
worksheet) or a combobox on a userform (inside the VBE)?

If yes, then look at the .Style property of that combobox.



On 06/25/2010 04:44, IanC wrote:
Is there a way to allow a combobox entry to be selected from a list,
but
to
disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text
must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--



--
Dave Peterson




--
Dave Peterson



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Locking down a combobox

If "Select" is an option in the combobox list, then you should be able to use
something like:

Option Explicit
Private Sub UserForm_Initialize()
Dim iCtr As Long
With Me.ComboBox1
.Style = fmStyleDropDownList
'first item
.AddItem "(Select)"
'test data
For iCtr = 1 To 5
.AddItem "A" & iCtr
Next iCtr
'show that it works
.Text = "(Select)"
'or even use the top choice
'.ListIndex = 0
End With
End Sub

Personally, I'd modify all those settings via code. Then if (when!) I need the
same kind of form in another project, I can just copy the code and not have to
worry.

On 06/25/2010 08:32, IanC wrote:
Hi Dave

I'm not trying to change the Text property in code, but in the Properties
box in VBE.

Initailly, I had
Style = 0 - fmStyleDropDownCombo
Text = Select

When I changed Style to 2 - fmStyleDropDownList, Text automatically cleared.
Now when I try to enter something in Text, I get "Could not set the Text
property. Invalid property value."

If I copy/paste an entry from the list this is accepted, but if I try to
type anything in (even something in the list) I get the same failure.
MatchEntry is set to 2 - fmMatchEntryNone and MatchRequired is set to False.

Any ideas?

I think I've figured out a workaround for my code if I have to change it. As
an alternative to looking for the absence of "Select" with...
If Me.ComboBox1.Text = "Select" Then Me.CommandButton1.Enabled = False
I think I can set MatchRequired to True, then check the MatchFound property
with ...
If Me.ComboBox1.MatchFound = True Then Me.CommandButton1.Enabled = False

That said, if I use MatchRequired/MatchFound and change my code to suit, I
don't need to change the ComboBox Style as invalid entries will result in
the OK button being disabled.

--
Ian
--

"Dave wrote in message
...
I've never seen that .text property break using this.

You may want to try again or post more details.



On 06/25/2010 06:28, IanC wrote:
Thanks Dave. fmStyleDropDownList appears to be just what I needed.

The only drawback is that I need to rewrite some of my code. When I
select
this, the Text property becomes invalid. I currently have "Select"
appearing
in each ComboBox to prompt the user and some code that looks for the
absence
of this to enable a command button (ie each ComboBox must have an option
selected for the OK button to be enabled).

I'm sure I'll find a way round it.

--
Ian
--

"Dave wrote in message
...
Is this a combobox from the Control toolbox toolbar (if it's on a a
worksheet) or a combobox on a userform (inside the VBE)?

If yes, then look at the .Style property of that combobox.



On 06/25/2010 04:44, IanC wrote:
Is there a way to allow a combobox entry to be selected from a list,
but
to
disable any option to enter text manually?

I know I can set the MatchRequired property to ensure that any text
must
match an item in the list, but this still allows typing to be done. I
suspect I could use a ListBox, but I want the drop-down list to appear.

Any thoughts?

--
Ian
--



--
Dave Peterson



--
Dave Peterson




--
Dave Peterson
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
row locking, instead of file locking? Bob W Excel Discussion (Misc queries) 2 September 7th 07 09:36 PM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Combobox options based on the input of another combobox afmullane[_5_] Excel Programming 1 May 3rd 06 01:44 PM
ComboBox list reliant on the entry from a different ComboBox ndm berry[_2_] Excel Programming 4 October 4th 05 04:40 PM
How Do I Load A ComboBox RowSource From The Results Of Another ComboBox Minitman[_4_] Excel Programming 3 October 26th 04 07:58 PM


All times are GMT +1. The time now is 10:22 AM.

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"