Access/Outlook

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,352
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

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
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

mdmilner

Well-known Member
Joined
Apr 30, 2003
Messages
1,352
Hmmm, it always seems like as soon as I post I figure it out.
I think this is because I'm confusing Access. I've loaded up the reference and then attempted to use late binding.

Hmmm - I'm at a loss as to why late binding isn't working properly. I'd have thought it would have been the failsafe. My current work-around is to use early-binding.

Looks like I've got to start digging around on this NEW machine a bit more. The last Office install I did personally - so I knew every component that was on it. This one was a 'company standard' install and I'm thinking something is not quite correct. I'm sure I'll have to figure it out eventually.

If anybody has any guesses/hints, I'd really appreciate a tip on what to try to look for.

Mike
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,168,120
Messages
5,857,500
Members
431,882
Latest member
saaaaaaaaaaaaaaaaaaaaaa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top