troubleshooting Question

Error Using Outlook in VB.Net

Avatar of Chuck Wood
Chuck WoodFlag for United States of America asked on
Visual Basic.NET
5 Comments1 Solution356 ViewsLast Modified:
I have code that was working until about three days ago.
Code:
    Public Function Email(ByVal strTo As String, ByVal strSubject As String, _
      ByVal strBody As String, Optional ByVal strCC As String = "", Optional ByVal strAttachment As String = "", _
      Optional ByVal fDeliveryReq As Boolean = False, Optional ByVal fReadRecpt As Boolean = False) As Boolean
        Email = False
        Dim olMailItem As Int16, olImportanceHigh As Int16
        olMailItem = 0
        olImportanceHigh = 2
        ' set the initial state of the function
        Email = False
        Dim outl As New Outlook.Application, intI As Integer
        ' create an email item
        Dim outMsg As Outlook.MailItem
        outMsg = outl.CreateItem(olMailItem)
        With outMsg
            ' set the message parts
            .To = strTo
            .Subject = strSubject
            .Body = strBody
            .CC = strCC
            .Importance = olImportanceHigh
            .OriginatorDeliveryReportRequested = fDeliveryReq
            .ReadReceiptRequested = fReadRecpt
            ' send the message
            .Send()
            ' set the final state of the function
            Email = True
        End With
    End Function
End Module

When this code is run, it errors at "Dim outl As New Outlook.Application" with this error:

An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in CSIDTest.exe
Additional information: The RPC server is unavailable.

I am using VB.Net in Visual Stuio 2003. I have a reference to the Microsoft Outlook 9.0 Object Library.
Again, this code worked perfectly until recently.

What is causing this error?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros