DCOM error with Outlook object
Hello to all!
I have written a few simple VB applications that automate some file refreshing, downloading and updates for our intranet. These programs work perfectly when I run them manually (i.e. double-click on the .exe file), but when I schedule them using the NT scheduler the programs all hang during the last commands of the program. In all cases the commands are to send an email notification via Outlook to myself indicating that the files have been updated successfully.
The event viewer shows the following error for each program:
---
the server {0006f03A-0000-0000-C000-000000000046} did not register with DCOM within the required timeout
---
From the research I have done, I think I need to declare a dataspace object but I am not sure.
Thanks to anyone who can help!!!
Joe
The code itself looks like this...
---
Sub send_notice()
Dim objOutlook As New Outlook.Application
Dim objmessage As Outlook.MailItem
Dim ad1 As String
Dim ad2 As String
Load Form1
Form1.Show
Set objmessage = objOutlook.CreateItem(olMailItem)
ad1 = "joe_o'[email protected]"
ad2 = "[email protected]"
With objmessage
.To = ad1
.To = .To & ";" & ad2
.Subject = "TEST Successfully refreshed!"
.Body = vbCrLf
.Body = .Body & "The adq1ats report has been successfully refreshed."
.Body = .Body & " The updated document was posted to the intranet on "
.Body = .Body & Format(Now(), "mm/dd/yy") & " @ " & Format(Now(), "hh:mm:ss")
.Body = .Body & " " & vbCrLf
.Body = .Body & " " & vbCrLf
.Body = .Body & vbCrLf
.Body = .Body & "Thanks-merci" & vbCrLf
.Body = .Body & "Canadian SFA"
.Send
End With
End Sub