Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Adding an input box to a custom toolbar

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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding custom images to a button on custom toolbar Mousam Excel Programming 1 July 13th 07 04:28 PM
Adding a check mark to the custom made toolbar/menu continue...... aiyer[_59_] Excel Programming 0 September 2nd 04 12:52 AM
Adding a Custom Toolbar to an .xla, not to Excel globally RJ Lohan Excel Programming 4 May 5th 04 09:03 AM
custom toolbar buttons are saved where? Excel loads twice bymistake and all my custom toolbar buttons get gone!!! Kevin Waite Excel Programming 2 March 3rd 04 03:31 PM
saving toolbar buttons on custom toolbar Paul James Excel Programming 12 August 6th 03 08:28 AM


All times are GMT +1. The time now is 10:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"