Create TextBox in Outlook toolbar



Hi, I have below code in my Outlook VBA code which creates tool bar and
button. I also want to create the TextBox and when user enter something into
TextBox and press Enter, it should show message. Could any one tell me how
could I do it?

Private Sub CreateToolBar()
Const TOOLBARNAME = "MyToolbar"
Dim ofcBar As Office.CommandBar
On Error Resume Next
'Test to see if the toolbar already exists'
Set ofcBar = Outlook.Application.ActiveExplorer.CommandBars(TOOLBARNAME)
On Error GoTo 0
If TypeName(ofcBar) = "Nothing" Then
'Create the toolbar'
Set ofcBar =
Outlook.Application.ActiveExplorer.CommandBars.Add(TOOLBARNAME, msoBarTop,
False, True)
Set DESDialButton =
MyToolbarApp.ActiveExplorer.CommandBars.Item("MyToolbar").FindControl(, ,
"891", False, True)
If TypeName(DESDialButton) = "Nothing" Then
Set DESDialButton =
MyToolbarApp.ActiveExplorer.CommandBars.Item("MyToolbar").Controls.Add(msoControlButton, , "891", , True)
End If
With DESDialButton
.BeginGroup = True
.Caption = "MyButton"
.Enabled = True
.OnAction = "!<DESDialAddin.Connect>"
.FaceId = 275
.Style = 3
.Tag = "891"
.Visible = True
End With
End If
ofcBar.Visible = True
Set ofcBar = Nothing
End Sub



Ken Slovak - [MVP - Outlook]

You can't. There is no textbox control for command bars. As close as you'd
get is a dropdown control and that's something quite different.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question