how can i add a custom ctl (DTPicker for example) in a commanbar

  • Thread starter Thread starter Guest
  • Start date Start date
If you created your own custom command bar and added a macro to open a
form that contains the date picker that might work, however if you're
wanting to take the value and use it on a form, you'll have to develop
code to do that. If the form is opened directly from another, you can
pass the value of the opening form to the date picker form via the
OpenArgs parameter. From there when the picker form closes, you would
use the Close event to send the value back to the opening form. If the
picker form opens from the command bar, I don't see how you'd
communicate to the picker form which form you'd like the value to be
returned to.
 
i try to add a MsoControlType=0 - 'Custom Control Type' for
CommandBarControl. But i don't know how to specify what custom control and
the correct sintax.
i found an example like:
--
Dim ControlSearch As CommandBarControlCustom, ControlEdit As
CommandBarPopup
Dim Control As CommandBarControl
Dim crtlSearchForm As New frmSearch

Set ControlEdit =
CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&Edit", -1, False)
With ControlEdit.CommandBar.Controls

Set Control = .Add(xtpControlPopup, 0, "&Search", -1, False)
Set ControlSearch =
Control.CommandBar.Controls.Add(xtpControlCustom, ID_SEARCH_FORM, "Search
Form", -1, False)
ControlSearch.Handle = crtlSearchForm.hwnd

End With
 
Didn't specify this originally - create a new form onto which the
DTPicker is placed, save the form and then open the form using a macro
action *HOWEVER* while this is a method that accomplishes the inital
question - I do not recommend it since it might get ugly trying to get
the value from the picker to whichever control you're trying to put it
in. (Plus, I failed to do the obvious...)

Why do you want the date picker to be accessed from a command bar?
 
Back
Top