Outlook Reference Problem - 05-22-2009 , 09:35 AM
Re: Access 2003 / Outlook 2007
I have Access 2003/Outlook 2007 on my development PC.
My customers have Access 2003/Outlook 2003 on their PC.
When they run the part of the app that uses the Outlook object, they
get a "cannot find object or project library" error. (I think) This
is because I have Outlook 2007 installed, the app was compiled with
these objects and the user does not have Outlook 2007.
I launched the Access app and went into Tools/References and saw the
error on the customers' PC.
Is there a way via code to tell "Tools/References" to use an Outlook
2003 object in the app even though Outlook 2007 is installed on my
Re: Outlook Reference Problem - 05-22-2009 , 10:11 AM
'Example on call
Dim b As Boolean
b = IsOutlookOpen()
'function to see if Outlook is open
Public Function IsOutlookOpen() As Boolean
On Error GoTo 0
On Error Resume Next
Dim objOutlook As Object
'Create the Outlook session.
Set objOutlook = GetObject(, "Outlook.Application") 'get ref
'if Outlook is already running.
If Err.Number = 429 Then 'Error 429
'occurs if Outlook is NOT running.
'Create a new instance of the Outlook application.
Set objOutlook = CreateObject("Outlook.Application")
If Err.Number = 429 Then
'Error 429 will occur if MS Outlook is not installed.
MsgBox Err.Number & " - " & Err.Description & _
vbNewLine & _vbNewLine & _
"MS Outlook is not installed on your computer", , _
ElseIf Err.Number <> 0 Then
MsgBox "Please open MS Outlook first.", , "IsOutlookOpen"
IsOutlookOpen = True
IsOutlookOpen = True
Set objOutlook = Nothing
Re: Outlook Reference Problem - 05-22-2009 , 03:13 PM
RLN <rlntemp-gng (AT) yahoo (DOT) com> wrote:
Late binding means you can safely remove the reference and only have an error when
the app executes lines of code in question. Rather than erroring out while starting
up the app and not allowing the users in the app at all. Or when hitting a mid, left
or trim function call.
This also is very useful when you don't know version of the external application
will reside on the target system. Or if your organization is in the middle of moving
from one version to another.
For more information including additional text and some detailed links see the "Late
Binding in Microsoft Access" page at http://www.granite.ab.ca/access/latebinding.htm
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Granite Fleet Manager http://www.granitefleet.com/