ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Application.SendKeys "%{down}" (https://www.excelbanter.com/excel-discussion-misc-queries/91006-application-sendkeys-%25%7Bdown%7D.html)

damorrison

Application.SendKeys "%{down}"
 
I am trying to get a combobox in a userform to open when it is selected
but cann't get it to work, here's what I was thinking...


TextBox1.TabIndex = 1
TextBox2.TabIndex = 2
TextBox3.TabIndex = 3
TextBox4.TabIndex = 4
ComboBox1.TabIndex = 5
With ComboBox1
Application.SendKeys "%{down}"
End With
How can I get this to Work


Leith Ross

Application.SendKeys "%{down}"
 

Hello damorrison,

You need to place the drop down command in the ComboBox's Enter Event.
Double click the ComboBox on the UserForm. This will bring up the code
window for the default event. In this case it is the Change Event. At
the Top Right of the code window, you should see the word Change. Click
the down arrow to see the other events. Scroll down to Enter in the list
and click it. The editor should insert the following in the code
window...

Private Sub ComboBox1_Enter()

End Sub


Insert the following in between the above lines to trigger the Drop
Down when the ComboBox is Selected...

Application.SendKeys "^{F4}"

Your code should look like this...

Private Sub ComboBox1_Enter()

Application.SendKeys "^{F4}"

End Sub

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=546300


[email protected]

Application.SendKeys "%{down}"
 
Do this:

ComboBox1.SetFocus
Application.SendKeys "%{down}"


damorrison

Application.SendKeys "%{down}"
 
Thanks alot, works great



All times are GMT +1. The time now is 12:54 PM.

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