|
-
Dec 24th, 2015, 06:32 AM
#1
Thread Starter
Fanatic Member
Seeking to add custom items to context menu
I am using VS2015 and trying to create an outlook addin to add custom context menu items (when a user right-clicks on a mail item for instance). I have read this article:
https://msdn.microsoft.com/en-us/lib...or=-2147217396
However, I cannot get the GetCustomUI method to fire. Here is my code:
Code:
Public Class ThisAddIn
Implements Microsoft.Office.Core.IRibbonExtensibility
Private WithEvents myApp As Outlook.Application
Private Sub ThisAddIn_Startup()
Try
myApp = Me.Application
Catch ex As System.Exception
Diagnostics.Debug.Print(ex.Message)
End Try
End Sub
Private Sub ThisAddIn_Shutdown()
End Sub
Public Function GetCustomUI(RibbonID As String) As String Implements IRibbonExtensibility.GetCustomUI
Diagnostics.Debug.Print(RibbonID)
Return ""
End Function
End Class
Can anyone help me find what I might be missing?
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Dec 24th, 2015, 05:03 PM
#2
Re: Seeking to add custom items to context menu
Public Function GetCustomUI(RibbonID As String) As String Implements IRibbonExtensibility.GetCustomUI
as far as i can see, this function is not being called, ribbonid has no value, there is no code to actually add items to the ribbon
follow the links on link you posted for some examples
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Jan 4th, 2016, 05:39 AM
#3
Thread Starter
Fanatic Member
Re: Seeking to add custom items to context menu
 Originally Posted by westconn1
as far as i can see, this function is not being called, ribbonid has no value, there is no code to actually add items to the ribbon
follow the links on link you posted for some examples
Yes, I realise there is no code to add ribbon items but I need the routine to actually be invoked before I add them and it currently isn't. The article suggests that merely by implementing the IRobbonExtensibility interface it will be invoked.
Everything I say is either loose interpretation of dubious facts or idle speculation rooted in irrational sentiment. 
-
Jan 4th, 2016, 02:47 PM
#4
Re: Seeking to add custom items to context menu
normally such a function is called in the appropriate workbook open event and the additional controls removed from the ribbon on workbook beforeclose event
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|