I have code that was working until about three days ago.
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)
' set the message parts
.To = strTo
.Subject = strSubject
.Body = strBody
.CC = strCC
.Importance = olImportanceHigh
.OriginatorDeliveryReportRequested = fDeliveryReq
.ReadReceiptRequested = fReadRecpt
' send the message
' set the final state of the function
Email = True
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?