Re: Paste to Toolbar Textbox by Benz
Benz
Tue Sep 18 15:58:01 CDT 2007
Thank you! I apprecaite the help. It's a textbox so there won't be any drop
down items. But im still not able to paste the selection to the textbox ,
what can I put in the place of 'add' to it has the right target?
Controls.Add(Type:=msoControlComboBox, Before:=1)
Thank you,
Ben Z.
"Helmut Weber" wrote:
> Hi Benz,
>
> it must have been more than an hour
> to find out whats wrong.
>
> You have to define the control you add as msoControlComboBox.
>
> No:
> Controls.Add(Type:=msoControlEdit, Before:=1)
> Yes:
> Controls.Add(Type:=msoControlComboBox, Before:=1)
>
> Otherwise you can set its text, but the additem-method fails.
> Though setting the text of a combobox works,
> it is entirely useless, as there would be
> no different items to choose from.
>
> ' -------------------------------------------
> Sub Ldtaskbr()
> Dim sendbar As CommandBar
> Dim sendbox As CommandBarComboBox
> Set sendbar = Application.CommandBars("Custom01")
> Set sendbox = sendbar.Controls.Add(Type:=msoControlComboBox, _
> Before:=1)
> End Sub
>
> ' -------------------------------------------
>
> Sub test1()
> Dim sendbar As CommandBar
> Dim sendbox As CommandBarComboBox
> Set sendbar = Application.CommandBars("Custom01")
> Set sendbox = sendbar.Controls(1)
> With sendbox
> .AddItem Selection.Text
> End With
> End Sub
>
> HTH
>
> --
> Greetings from Bavaria, Germany
>
> Helmut Weber, MVP WordVBA
>
> Win XP, Office 2003
> "red.sys" & Chr$(64) & "t-online.de"
>
>
>