LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default creating Toolbar on Word 2000 using built-in Visual Basic Editor

Hi All,

I have some queries.

I am creating Toolbar on Word 2000 using built-in Visual Basic Editor.

First query is regarding CommandBarButtons Click event not firing usin
WithEvents keyword.


Also since the CommandBar is created dynamically I dont know how to
take the values entered in its various controls at runtime.
When I enter something into ComboBox and I shift to another control
the value entered in the comboBox is lost. How to prevent this.

My Code is as follows:

Public WithEvents cbcCommandBarButton As Office.CommandBarButton
Dim cbrCommandBar As CommandBar
Public cbcCommandBarListBox As CommandBarComboBox
Public cbcCommandBarCategoryListBox As CommandBarComboBox
Public cbcCommandBarSearchCriteriaListBox As CommandBarComboBox
Dim m_IE As InternetExplorer

Sub NewToolBar()

' If the command bar exits, remove it.
On Error Resume Next
Application.CommandBars("Marsh Knowledge Exchange").Delete

' Add the command bar to the application's
' CommandBars collection.
Set cbrCommandBar = _
Application.CommandBars.Add
cbrCommandBar.Name = "Knowledge Exchange"

' Add command button control to the control's
' collection of CommandBar objects.
With cbrCommandBar.Controls
Set cbcCommandBarButton = _
.Add(msoControlLabel)
' ' Set properties of the command button.
'Add the following lines of code just below the block o
'code beginning with the comment "Set properties of the comman
button."
' Set properties of the drop-down list box.
Set cbcCommandBarListBox = _
.Add(Type:=msoControlDropdown)
With cbcCommandBarListBox
.AddItem " Knowledge Exchange Home"
.AddItem " Practice Home"
.AddItem " Research Centre"
.AddItem " My KX"
.AddItem " My Assignments"
.Width = 138
.ListIndex = 5
.Caption = " Knowledge Exchange Home "
.Style = msoComboLabel
.BeginGroup = True
.OnAction = "DisplayMessage"
.Tag = "lstPractice"
End With

'Code to create the Search Criteria Combo-box
Set cbcCommandBarSearchCriteriaListBox = _
.Add(Type:=msoControlComboBox)

'Code to create the Search Criteria Combo-box

'Code to create the Search Categories Combo-box
Set cbcCommandBarCategoryListBox = _
.Add(Type:=msoControlComboBox)
With cbcCommandBarCategoryListBox
.AddItem " Search Knowledge Exchange Home"
.AddItem " Search Google"

.Width = 138
'.ListIndex = 6
'.Caption = " "
.Style = msoComboNormal
.BeginGroup = True
.OnAction = "Message"
.Tag = "lstCategory"
End With

' Set cbcCommandBarButton = _
' .Add(Type:=msoControlButton)
'
' ' Set properties of the command button.
' With cbcCommandBarButton
' .Style = msoButtonIconAndCaption
' .Caption = "My Big Button"
' .FaceId = 19
' .OnAction = "Message"
' .Tag = "My Big Button"
' End With




End With



cbrCommandBar.Visible = True


End Sub



Could you please tell me how these problems are solved. Can you send
me the code if possible.

Regards,
Sagar Gadre

--
Message posted from http://www.ExcelForum.com

 
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
Opening Visual Basic Editor SteveG[_5_] Excel Discussion (Misc queries) 0 March 19th 09 01:46 PM
Visual Basic Editor Ron Rueter Excel Discussion (Misc queries) 3 October 28th 08 02:48 PM
Password in Visual basic editor Tia[_3_] Excel Worksheet Functions 0 July 11th 08 08:40 AM
Visual Basic Editor opens bi itself KG Excel Discussion (Misc queries) 0 September 15th 07 04:02 PM
Visual basic editor Answerfactory Excel Discussion (Misc queries) 3 October 9th 06 09:13 PM


All times are GMT +1. The time now is 06:19 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"