D
Dewey
Please help!
I've been trying to send an email from within a COM addin in VB.net 2005,
but keep getting a very weird message:
'Unable to cast object of type 'System.__ComObject' to type
'Microsoft.Office.Interop.Outlook.ApplicationClass'.
I am trying to send from a form in a COM addin that I open from within
Outlook
Here's the sub I use:
-----------------------------
Private Sub SendMail( )
Dim myOlApp As Outlook._Application
'Dim myOlApp As Object
Dim MyItem As Outlook._MailItem
Dim luvRecipients As Outlook.Recipients
Dim luvRecipient As Outlook.Recipient
myOlApp = New Outlook.Application
'MyItem = myOlApp.CreateItem(OlItemType.olMailItem)
'MyItem.Display()
On Error Resume Next
'this is the body of the email
MyItem.Subject = "Image sending test"
MyItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
MyItem.HTMLBody = "<HTML><DIV ALIGN=CENTER><IMG
src='\\Fil-nw04-10\hello.jpg></HTML>"
MyItem.Send()
End Sub
I've been trying to send an email from within a COM addin in VB.net 2005,
but keep getting a very weird message:
'Unable to cast object of type 'System.__ComObject' to type
'Microsoft.Office.Interop.Outlook.ApplicationClass'.
I am trying to send from a form in a COM addin that I open from within
Outlook
Here's the sub I use:
-----------------------------
Private Sub SendMail( )
Dim myOlApp As Outlook._Application
'Dim myOlApp As Object
Dim MyItem As Outlook._MailItem
Dim luvRecipients As Outlook.Recipients
Dim luvRecipient As Outlook.Recipient
myOlApp = New Outlook.Application
'MyItem = myOlApp.CreateItem(OlItemType.olMailItem)
'MyItem.Display()
On Error Resume Next
'this is the body of the email
MyItem.Subject = "Image sending test"
MyItem.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
MyItem.HTMLBody = "<HTML><DIV ALIGN=CENTER><IMG
src='\\Fil-nw04-10\hello.jpg></HTML>"
MyItem.Send()
End Sub