hi
i know of nothing built into excel that would do that.
what i would do is put a custom icon on the toolbar to lauch the macro and
start the macro with an input box.
sub example()
dim txt as string
txt = inputbox ("enter something")
'txt would be the variable input into the inputbox.
your code here
end sub.
it would do essentially what you want except the input box wouldn't be on
the toolbar, just the custom icon that lauches the macro.
my thoughts
Regards
FSt1
> Hello
>
[quoted text clipped - 8 lines]
> Thanks
> Charles
cht13er - 28 Mar 2008 01:10 GMT
> hi
> i know of nothing built into excel that would do that.
[quoted text clipped - 25 lines]
> > Thanks
> > Charles
I've never heard of it / seen it either ... if you find anything be
sure to post it here!
(The advice from FSt1 sounds good)
Chris
Charles - 28 Mar 2008 08:36 GMT
I've actually been lucky:
http://www.ozgrid.com/forum/showthread.php?t=23224
it looks like this would work. tricky....
Public Const g_strCBRName As String = "MyCustomBar"
Sub CustomTB()
Dim cbrTemp As CommandBar
Dim objDrop As CommandBarControl
RemoveCustomTB
'Create commandbar
Set cbrTemp = Application.CommandBars.Add(g_strCBRName)
With cbrTemp
' Add control
Set objDrop = .Controls.Add(msoControlComboBox)
With objDrop
' add items
.AddItem "Andy"
.AddItem "Bob"
.AddItem "Charlie"
.OnAction = "cbrTest"
End With
' Add control textbox
Set objDrop = .Controls.Add(msoControlEdit)
With objDrop
.OnAction = "ctxTest"
End With
.Visible = True
End With
End Sub
Sub cbrTest()
MsgBox "You selected " &
Application.CommandBars(g_strCBRName).Controls(1).Text
End Sub
Sub ctxTest()
MsgBox "You entered " &
Application.CommandBars(g_strCBRName).Controls(2).Text
End Sub
Sub RemoveCustomTB()
' Try and delete commandbar
On Error Resume Next
Application.CommandBars(g_strCBRName).Delete
End Sub
Thanks
Charles