"enter" event of activex combobox?

C

crapit

1) How to detect that <enter> is press on a editable combobox activeX
control?
From property of combobox, Style is set to DropDownCombo!

2) How to stop ActiveX control Date and Time Picker resize automatically?
As I'm using Worksheet_SelectionChange to detect that if certain range of
cell is selected, then Date and Time Picker control will appear.
However, it did not appear correctly at the specified position all the
times, and usually a "ghostly" image also occur.
 
C

crapit

If the worksheet contain 8 combobox (activex), do I need to insert keydown
event for each box
 
C

crapit

How about the 2nd problem?

How to stop ActiveX control Date and Time Picker resize automatically?
As I'm using Worksheet_SelectionChange to detect that if certain range
of cell is selected, then Date and Time Picker control will appear.
However, it did not appear correctly at the specified position all the
times, and usually a "ghostly" image also occur.
The worksheet contains only 1 Date and Time Picker for a column. (i.e only 8
rows of date and time is require for the user). Is it better to have
individual Date and Time Picker for each row?
 
T

Tom Ogilvy

I offered DoEvents in the original post. I can't say exactly what problem
you are having, so don't have a pat solution for you.
 
P

Peter Beach

Hi,

DoEvents is a slightly misnamed routine. In other places it is known as
"yield". What it does is suspend the current thread and allow all the other
pending "events" to execute before resuming the active thread.

It is not a universal panacea, particularly in VBA, as XL may well be
running the thread you want to "yield". Nevertheless it is a good place to
start to try and work out why your screen is not redrawing as you expect.

Regards,

Peter Beach
 
T

Tom Ogilvy

No, I suggested using the command doevents after you issue the command to
display the date time picker at the specified location. Hopefully this will
correct the ghost image problem you describe. Peter has kindly offered an
explanation of what DoEvents does.
 
C

crapit

So can I say write as follow
DoEvents
'define position of Date and Time Picker
DTPicker_date.Left = Target.Left
DTPicker_date.Top = Target.Top + (Target.Height / 4)
ActiveCell.Value = DTPicker_date.Value
DTPicker_date.Visible = True
 
T

Tom Ogilvy

You can, but it would add no value. You want it after you make the control
visible.


'define position of Date and Time Picker
DTPicker_date.Left = Target.Left
DTPicker_date.Top = Target.Top + (Target.Height / 4)
ActiveCell.Value = DTPicker_date.Value
DTPicker_date.Visible = True
DoEvents
 
C

crapit

The height of the DT Picker always go beyond the original length, despite
setting the value during workbook open
and as well as when the cell is selected using

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Application.Intersect(Range("D17"), Target) Is Nothing Then
Worksheets("Manhours Booking Request Form").DTPicker_date.Left =
Target.Left
Worksheets("Manhours Booking Request Form").DTPicker_date.Top =
Target.Top + (Target.Height / 4)
Worksheets("Manhours Booking Request Form").DTPicker_date.Height = 16.5
DoEvents
ActiveCell.Value = DTPicker_date.Value
DTPicker_date.Visible = True
elseif .....
 
Top