ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform combobox dropdown question (https://www.excelbanter.com/excel-programming/389925-re-userform-combobox-dropdown-question.html)

Incidental

Userform combobox dropdown question
 
Hi TP

Not exactly sure what your aiming for here but if you don't want the
user to be able to change the value of the combobox you could just set
it to be locked use code something like

ComboBox1.List = Array("", "blah", "BLah", "BLAH")
ComboBox1.ListIndex = 3
ComboBox1.Locked = True

will lock the combobox to show the value BLAH

hope this helps you out

S




teepee

Userform combobox dropdown question
 

"Incidental" wrote in message
oups.com...
Hi TP

Not exactly sure what your aiming for here but if you don't want the
user to be able to change the value

Thanks for trying to help. All I'm really trying to do is to get the
combobox to retract after a selection is made. At the moment you have to
click the selection twice - onced to select and then again to shrink the
list down to sized again. Then you have to click something else on the form
to deselect the combobox in order for any of the other buttonsit to work.
Not very user friendly...



Incidental

Userform combobox dropdown question
 
Hi there

It is early in the morning here and I have read your post a few times
but I still don't understand why don't you post a bit of you code and
some descriptions of what controls are called and I will have a look
see what I can figure out, can't promise I will be able to do anything
but I will give it a go for sure.

S




teepee

Userform combobox dropdown question
 
Many thanks. I'm most grateful.

This is in a userform combobox with a media player object. The combobox
selects a phrase (eg "start of movie scene two") linked to a number which
tells the media player where to start playing the video from. But the list
then sits in front of the video unless you click on the combobox list again
to get rid of it. And then you have to click on it a third time to deselect
it completely and allow access to other shapes and media player controls. I
want to get rid of the need for that second and third click.

Private Sub Combobox1_change()


With Me.ComboBox1
If .ListIndex < 0 Then
Beep
Else
'pick out the second column
myVar = .List(.ListIndex, 1)

'show mediaplayer at the correct position
MP.CurrentPosition = myVar


End If
End With

' here follow a few failed attempts to get the combobox to retract
again after the previous command....

' DropDowns("Drop Down 1").Select
'Selection.Delete

' wih Me.DropDowns("drop down 1")
' .Visible = msoFalse
' End With

' With Me.Shapes("Drop Down 1")
' Selection.Delete
'End With

'ComboBox1.DropDown = false


End Sub

and

Private Sub UserForm_Initialize()

Dim myRng As Range


With ThisWorkbook.Worksheets("sheet2")
'defines the contents of the listbox in ff and a linked value in fg
Set myRng = .Range("ff1:fg" & .Cells(.Rows.Count,
"ff").End(xlUp).Row)
End With

With Me.ComboBox1
.ColumnCount = myRng.Columns.Count
.List = myRng.Value
.ColumnWidths = "33;0"
End With


"Incidental" wrote in message
oups.com...
Hi there

It is early in the morning here and I have read your post a few times
but I still don't understand why don't you post a bit of you code and
some descriptions of what controls are called and I will have a look
see what I can figure out, can't promise I will be able to do anything
but I will give it a go for sure.

S





teepee

Userform combobox dropdown question
 

"Susan" wrote in message
oups.com...
ummmmmmm....... i have bad news.
from fairly thorough searching of the newsgroup regarding excel losing
focus, i found (when i was trying to do it myself), that basically you
can't. once excel loses focus, vba won't run. vba isn't running
windows. so vba can't return focus from another application (in
windows) to excel (in windows).
personally, i was trying to have excel open windows media player &
start a sound file, then return to excel - you said "a" media player
so i don't know if it's the same one or not, but i couldn't see how to
do it (or see how anybody ELSE did it).


Unles I'm misunderstanding you, I'm not sure we're talking about the same
thing. This media player IS a VBA object which runs, responds to, and is
totally controlled by Excel and VBA (perhaps that approach would solve your
problem?)

What I need to do is switch the focus from the combobox to the media
player.



Susan

Userform combobox dropdown question
 
excel has a media player?????? where??????????

i'd love to understand what you're talking about, cuz perhaps i could
also use it, as you said.

if you search the newsgroup for "excel play sounds", you'll see
there's quite a few posts on this, which i haven't been able to get to
work (including the stupid BEEP command). :) what type of media
are you playing? video, i think you said.
well, maybe somebody else knows what you are talking about, because
obviously i don't. ha ha.
i'll keep watching, tho.
susan



On May 24, 5:25 pm, "teepee" wrote:
"Susan" wrote in message

oups.com...
ummmmmmm....... i have bad news.
from fairly thorough searching of the newsgroup regarding excel losing
focus, i found (when i was trying to do it myself), that basically you
can't. once excel loses focus, vba won't run. vba isn't running
windows. so vba can't return focus from another application (in
windows) to excel (in windows).
personally, i was trying to have excel open windows media player &
start a sound file, then return to excel - you said "a" media player
so i don't know if it's the same one or not, but i couldn't see how to
do it (or see how anybody ELSE did it).

Unles I'm misunderstanding you, I'm not sure we're talking about the same
thing. This media player IS a VBA object which runs, responds to, and is
totally controlled by Excel and VBA (perhaps that approach would solve your
problem?)

What I need to do is switch the focus from the combobox to the media
player.




teepee

Userform combobox dropdown question
 

"Susan" wrote in message
oups.com...
excel has a media player?????? where??????????

i'd love to understand what you're talking about, cuz perhaps i could
also use it, as you said.

Create a userform in VBA editor
Select toolbox
Right click toolbox
Select additional controls
Tick windows media player
Go back to toolbox and drag & drop the WMP icon into the userform

You now have a VBA programable Windows Media Player



Susan

Userform combobox dropdown question
 
oooooohhh!
& i assume it works, except for the combobox issue.......
thanks!
susan


Create a userform in VBA editor
Select toolbox
Right click toolbox
Select additional controls
Tick windows media player
Go back to toolbox and drag & drop the WMP icon into the userform

You now have a VBA programable Windows Media Player





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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com