Question Access 2007 to Outlook 2010

chaver

New member
Local time
Today, 07:10
Joined
Jan 29, 2011
Messages
7
I have an application written in Access 2007 that automatically sends emails with attachments through Microsoft Outlook.

I have installed this onto a users system using the Access 2007 runtime. This user has Office 2010 (not Access). Access 2007 fails when trying to create emails in MS Outlook 2010.

Does anyone know of a solution to this? Apart from upgrading to Access 2010!
 
Hi Paul

Tx for responding - I think you are probably right - the current declarations are:

Public Sub SendMessage(DisplayMsg As Boolean, emailaddr As String, Subject As String, MSG As String, Optional AttachmentPath)

Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

That kind of assumes it already knows where Outlook.Application is to be found.
As I understand it - to change this to late binding I need to change the first declaration to just

Dim objOutlook As Object

But what do I change the other declarations to

Dim objOutlookMsg As ?
Dim objOutlookRecip As ?
Dim objOutlookAttach As ?

I presume the subsequent code should remain as is -

Set objOutlook = CreateObject("Outlook.Application")
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
Set objOutlookRecip = .Recipients.Add(emailaddr)
objOutlookRecip.Type = olTo
.Subject = Subject
.Body = MSG
.Importance = olImportanceHigh 'High importance
If Not IsMissing(AttachmentPath) Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
etc

---------------------------------------------
OK - I changed the other declarations to Object as well

Dim objOutlookMsg As Object
Dim objOutlookRecip As Object
Dim objOutlookAttach As Object

This worked fine on my system running on full Access 2007 with Outlook 2007 but when compiled and run on the user's system with 2007 Runtime & Outlook 2010 it still comes up with the same error: Application-defined or Object-defined error.

I have traced the error on the user's system to the statement:

Set objOutlookRecip = .Recipients.Add(emailaddr)

that is where it falls over.

I have checked the user's system and the library MSOUTL.OLB only appears in the Office14 folder i.e. the file is not present in the Office12 folder - could it have something to do with the library file?

Thanks
chaver
 
Last edited:
Did you ever fix this as I have the same problem and need to create emails with the correct recipient
 
Did you ever fix this as I have the same problem and need to create emails with the correct recipient

In my case I had a conflict of permission rights between Access 2007 and the Microsoft Outlook 14.0 Object Library of Outlook 2010. A short-term solution could be to copy the msoutl.olb file of your old Microsoft Outlook 12.0 Object library of Outlook 2010 in a folder and link your Access 2007 to that particular reference.

I said that it's a temporal solution since I have no much time to solve the conflict itself and not need to use that old reference, and also I am not sure if referencing Access 20074 to the Library of Outlook 2007 could affect something else of my other applications in 2011.

I hope that it works for you. Regards.
 

Users who are viewing this thread

Back
Top Bottom