I'm trying to hunt down a problem. This isn't the entire function but it's the meat of it to send an email. This worked well under A2K and Win2K - but now on a WinXP install it's dying with the message:
Error 429: ActiveX Component can't create object right where it's attempting to create Outlook.Application.
Only real difference I see is the Outlook 9.0 Object library isn't loaded - just the Outlook 11.0 Object library (in the references)...and I'm wondering if that might be part of the problem.
Really, I'm just beginning to troubleshoot this.
Mike
Error 429: ActiveX Component can't create object right where it's attempting to create Outlook.Application.
Only real difference I see is the Outlook 9.0 Object library isn't loaded - just the Outlook 11.0 Object library (in the references)...and I'm wondering if that might be part of the problem.
Really, I'm just beginning to troubleshoot this.
Mike
Code:
Public Function sendMail(ByVal Recipient As String, _
ByVal Subject As String, _
ByVal Message As String, _
Optional ByVal AttachmentPath As String)
'Dim objOutlook As Outlook.Application
'Dim objOutlookMsg As Outlook.MailItem
'Dim objOutlookAttach As Outlook.Attachment
'Dim objOutlook As Object
Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutlookAttach As Object
'Dim MessageHeader
On Error GoTo HandleErr
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
.To = Recipient
.Subject = Subject
.Body = Message
.Importance = olImportanceNormal 'Selects importance
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
End With
objOutlookMsg.Send
End Function