Hvorledes kan jeg lave et menupunkt i Outlook context menu
Jeg har prøvet en masse men intet virker?Se kode stump
Private Sub Application_ItemContextMenuDisplay( _
ByVal CommandBar As Office.CommandBar, _
ByVal Selection As Selection)
Dim objButton As CommandBarButton
Dim intButtonIndex As Integer
Dim intCounter As Integer
On Error GoTo ErrRoutine
' Ensure we have only one item selected.
If Selection.Count = 1 Then
' Ensure we have a MailItem selected.
If Selection.Item(1).Class = olMail Then
' Find the location of the Reply To All button.
For intCounter = 1 To CommandBar.Controls.Count
If CommandBar.Controls(intCounter).ID = 355 Then
intButtonIndex = intCounter
Exit For
End If
Next
' If we have a Reply To All button in the
' context menu, add a new button to support
' the ReplyToNoncopied routine.
If intButtonIndex <> 0 Then
' Create a new menu item and place it
' just after the Reply To All button
Set objButton = CommandBar.Controls.Add( _
msoControlButton, , , intButtonIndex)
' Configure the menu item.
With objButton
.Style = msoButtonIconAndCaption
.Caption = "Repl&y to Non-copied"
.Parameter = Selection.Item(1).EntryID
.FaceId = 355
' If you place this sample in a class module
' other than ThisOutlookSession, update this
' line of code to ensure that the OnAction
' property contains the correct project,
' class, and routine name.
.OnAction = "Project1.ThisOutlookSession.ReplyToNoncopied"
End With
End If
End If
End If
EndRoutine:
On Error GoTo 0
' Place clean-up code here.
Exit Sub
ErrRoutine:
MsgBox Err.Number & " - " & Err.Description, _
vbOKOnly Or vbCritical, _
"Application_ItemContextMenuDisplay"
GoTo EndRoutine
End Sub
Følgende er kopieret direkte fra Outlook hjælp, men virker heller ikke, al makroi sikkerhed er pt. deaktiveret.
Er der ikke en der kan være behjælpelig med en stump kode som "bare" lave et menu punkt der har caption TEST
og som laver en msgbox ("Virker")
Så klarer jeg mig lidt igen.
