I have a simple Outlook Ribon button I am trying to create to forward a selected email to a set address. The probelm is when I click the button, it is not runing the code. I tried adding several break points and they never happen, even on the If statment below. Does anyone have any ideas?
I have not worked with Visual Basic .NET in several years, and I feel like it must be something simple I am missing.
Private Sub Button1_Click(sender As Object, application As Application) Handles Button1.Click
Dim myinspector As Outlook.MailItem
Dim myItem As Outlook.MailItem
myinspector = application.ActiveInspector.CurrentItem
If Not TypeName(myinspector) = "Nothing" Then
myItem = myinspector.CurrentItem.Forward
myItem.Display()
myItem.Recipients.Add("Dan Wilson")
myItem.Send()
Else
MsgBox("There is no active inspector.")
End If
Full Project Link if wanted: https://drive.google.com/file/d/1zQfUilsTZ6tRjgT7gP0wI1j_CefdqvDW/view?usp=share_link
I tried break points in multible places. I looked at multble example sites to see if code was correct.