Hey Ken ,
Thanks for quick reply, Can you please guide me in detail as to what should
I do once again , I did folling changes in create menu :
Private Sub createmenu()
Dim oControl As office.CommandBarControl
Dim m_ocontrolbar As CommandBarControl
Dim strMenu As String
Dim strTag As String
Dim strToolTip As String
Dim strCaption As String
Dim strKey As String
Dim blnMenuExists As Boolean
Dim oCommandBar As office.CommandBar
Dim oStandardBar As office.CommandBar
On Error Resume Next
strKey = CStr(m_intID)
mnuTag = "This string is unique to this menu" & strKey
strMenu = "Menu Bar"
strToolTip = "The ToolTip for the menu"
strCaption = "The caption for the menu"
'check for the menu existing already and do not create
' it if does exist. The checking code would set a
' Boolean variable named blnMenuExists.
If Not blnMenuExists Then
Set oControl = m_obj.CommandBars.FindControl(Tag:=btnTag)
Else
Set oControl = m_obj.CommandBars.FindControl(Tag:=btnTag)
End If
'now add a button to the new menu that was created
If Not (oControl Is Nothing) Then
Set m_ocontrolbar = oControl
strTag = "This string is unique to this button" & strKey
strToolTip = "The ToolTip for the button"
strCaption = "testing123"
'create the button here
Set ctlbtnpriv = oStandardBar.Controls.Add(Type:=msoControlButton,
Temporary:=True)
With ctlbtnpriv
.Caption = strCaption
.Tag = btnTag
.ToolTipText = strToolTip
.Style = msoButtonCaption
.Visible = True
End With
End If
' End If
Set oControl = Nothing
End Sub
'--------------------------------------------------------------------------
Private Sub m_objInsp_Activate()
On Error Resume Next
Call CreateButton(m_objInsp)
End Sub
Please , I really need your help.Thanks
Ken Slovak - [MVP - Outlook] wrote:
Your Activate() handler is calling to createmenu(), not to CreateButton().
It looks to me like at that call the reference to m_obj will be null
(Nothing) since nothing has initialized that object. You also need to set up
a Boolean flag that gets set to True when you have created the UI and check
that flag in Activate() so you don't end up creating new UI each time
Activate() fires. You only want to do that once.
You also should step your code and observe the state of Err and your objects
as you create your UI so you know what's happening.
Hey Ken ,
Thank you so much for replying to my query.Thanks alot.I have made
[quoted text clipped - 360 lines]
Thank you
--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ddins/200808/1