Private Sub Application_ItemContextMenuDisplay(ByVal CommandBar As Office.CommandBar, ByVal Selection As Selection)
Static intCounter As Integer
On Error GoTo ErrRoutine
' Increment or reset the counter
If intCounter 1 Or intCounter 100 Then
intCounter = 1
Else
intCounter = intCounter + 1
End If
' Add the menu.
Dim objMenu As Object
objMenu = CommandBar.Controls.Add(msoControlButton)
objMenu.Caption = "Displayed " & intCounter & " times"
objMenu.Enabled = False
objMenu.BeginGroup = True
EndRoutine:
On Error GoTo 0
Exit Sub
ErrRoutine:
MsgBox(Err.Number & " - " & Err.Description, _
vbOKOnly Or vbCritical, _
"Application_ItemContextMenuDisplay")
GoTo EndRoutine
End Sub
i'm getting error at
1) "Selection" (Type Selection is not defined)
2) "msoControlButton" (msoControlButton name not defined.)
i would like to do this in C#.Net. (or VB.Net)
could u suggest me to resolve this.
Regards,
Muppidi.
Last edited by pavanmuppidi : November 6th 08 at 07:14 AM.
|