I have taken over development of a VB .NET 3.5 project. I need to add a reference to Microsoft.Office.Interop.Outlook
for Office 2013, but it doesn't appear in my COM Reference list. I have Office 2013 installed. I have tried to find an installer for the PIAs, but I have not been able to find it for 2013.
Any suggestions?
UPDATE
I have upgraded to .NET 4, but I am not able to find the "Microsoft Outlook 15.0 Object Library" in my references (see above image). I tried installing them from the Office disk, but programability was already installed. I also installed the Office Developer Tools from the VS disk. I am at a loss on where to get this file from.
I tried switching to late binding with the following code:
Sub DisplayMail()
Dim oAPP As Object
Dim oItem As Object
Const olMailItem As Long = 0
oAPP = CreateObject("Outlook.Application")
oItem = oAPP.CreateItem(olMailItem)
With oItem
.To = Me.EmailAddress
.Subject = Me.MySubjectTextBox.Text.Trim.Replace("%", "%25").Replace("&", "%26")
.Body = Me.EmailMessageBox.Text.Trim.Replace("%", "%25").Replace(vbCr, "%0d%0A").Replace("&", "%26")
.Display()
End With
End Sub
This works when Outlook is closed, but if I have Outlook open, I get a "Cannot create ActiveX component" error.