If CommandBar.Parent.Type = xtpControlComboBox Then
Set Combo = CommandBar.Parent
Set Control = Combo
Select Case Combo.Id
Case ID_PREDICT_START, ID_CHART_START
dppStart.VisualTheme = xtpCalendarThemeResource
Set DatePicker = dppStart
strCurrentDate = m_strPopupStartDay
Case ID_PREDICT_END, ID_CHART_END
dppEnd.VisualTheme = xtpCalendarThemeResource
Set DatePicker = dppEnd
strCurrentDate = m_strPopupEndDay
End Select
If Combo.Id = ID_PREDICT_START Or Combo.Id = ID_PREDICT_END Or Combo.Id = ID_CHART_START Or Combo.Id = ID_CHART_END Then
'get the current value of the combo box
strCurrentDate = Combo.Text
bRestore = False
If IsDate(Combo.Text) Then
DatePicker.EnsureVisible Combo.Text
End If
Combo.GetRect lngLeft, lngTop, lngRight, lngBottom
'GetPosition lngLeft, lngTop, CommandBar, Combo
DatePicker.Left = lngLeft
DatePicker.Top = lngTop + (lngBottom - lngTop)
Debug.Print lngTop
If DatePicker.ShowModal(1, 1) Then
Dim strDate0 As String, strDate1 As String
Dim nCount As Long
nCount = DatePicker.Selection.BlocksCount
If nCount > 0 Then
'Control.Refresh
Combo.Clear
Combo.AddItem DatePicker.Selection.Blocks(0).DateBegin
Combo.AutoComplete = True
Combo.Text = DatePicker.Selection.Blocks(0).DateBegin
strDate0 = DatePicker.Selection.Blocks(0).DateBegin
strDate1 = DatePicker.Selection.Blocks(nCount - 1).DateEnd
Else
Combo.Clear
Combo.AddItem strCurrentDate
Combo.Text = strCurrentDate
strCurrentDate = "?-?-?"
End If
Else
Combo.Clear
Combo.AddItem strCurrentDate
Combo.Text = strCurrentDate
strCurrentDate = "?-?-?"
End If
Combo.ListIndex = 1
cbMain_TrackingModeChanged CommandBar, False
SendKeys vbCrLf
End If
End If
works fine for me. good luck