Outlook Object library

  • Thread starter Thread starter Andrew Cushen
  • Start date Start date
A

Andrew Cushen

Hi All-

I have a question I've never seen answered here. I
apologize if this is not the right forum for this
question, but:

Suppose I'm writing an app in VB that connects to Outlook.
I add a reference to the MS Outlook 9.0 Object library,
since I have Office 2000 installed on my machine.

What happens when a user installs my app, if the user has
only Office XP/Outlook Object library 10.0? Will my app be
able to connect to Outlook XP? What if the user has only
Outlook 97/98? What about Outlook 2003 or later?

Also, I've noticed that installing new versions of Office
does not remove all the Registry entries from previous
Office versions. I know for a fact that this is true for
the Master Category List- I have the Registry entries that
contain the MCL on my PC for Office 97, Office 2000, and
XP- even though only Office 2000 is actually present (I
installed and removed an Evaluation copy of Office XP).
Will my app get confused- if I reference the Outlook 2000
Obj. Library, will my app try to access Outlook 2000 even
if the user has replaced it with Outlook XP (or later)??

I am really confused on this issue, and need help ASAP.
Thank you for reading this kinda long post, and for your
help.

-Andrew Cushen
(delete REMOVETHIS from my e-maill address to reply
directly)
 
Hi,
If you've set a reference to a specific version of Outlook, then
that version must be on the PC that runs your program.

Unless you're writing for a controlled environment, it's better to use what's
called late binding, that way your app will work with ANY version of Outlook.

Well, as long as you don't use a feature that's not in an earlier version.

For example, here's some code that uses late binding. All variables are declared
As Object and there is NO reference to Outlook set for the project.

Function InitializeOutlook() As Boolean
' This function is used to initialize the global Application and
' NameSpace variables.

On Error Resume Next
Set golApp = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then
Set golApp = CreateObject("Outlook.Application")
On Error GoTo Init_Err
End If
On Error GoTo Init_Err
Set golNameSpace = golApp.GetNamespace("MAPI") ' Namespace object
InitializeOutlook = True
Init_Bye:

Exit Function
Init_Err:
InitializeOutlook = False
Resume Init_Bye

End Function

You would call it like this:

' Set global Application and NameSpace
' object variables, if necessary.
If golApp Is Nothing Then
If InitializeOutlook = False Then
MsgBox "Unable to initialize Outlook. "
Exit Sub
End If
End If
 
OK, Thanks.

So that code will work with any version of Outlook that
supports the given functionality? 97-2003?

-Andrew Cushen
=======================================================
-----Original Message-----
Hi,
If you've set a reference to a specific version of Outlook, then
that version must be on the PC that runs your program.

Unless you're writing for a controlled environment, it's better to use what's
called late binding, that way your app will work with ANY version of Outlook.

Well, as long as you don't use a feature that's not in an earlier version.

For example, here's some code that uses late binding. All variables are declared
As Object and there is NO reference to Outlook set for the project.

Function InitializeOutlook() As Boolean
' This function is used to initialize the global Application and
' NameSpace variables.

On Error Resume Next
Set golApp = GetObject(, "Outlook.Application")
If Err.Number <> 0 Then
Set golApp = CreateObject("Outlook.Application")
On Error GoTo Init_Err
End If
On Error GoTo Init_Err
Set golNameSpace = golApp.GetNamespace("MAPI") ' Namespace object
InitializeOutlook = True
Init_Bye:

Exit Function
Init_Err:
InitializeOutlook = False
Resume Init_Bye

End Function

You would call it like this:

' Set global Application and NameSpace
' object variables, if necessary.
If golApp Is Nothing Then
If InitializeOutlook = False Then
MsgBox "Unable to initialize Outlook. "
Exit Sub
End If
End If
--
HTH
Dan Artuso, Access MVP


"Andrew Cushen" <[email protected]> wrote
in message news:[email protected]...
 
Yep.

--
HTH
Dan Artuso, Access MVP


Andrew Cushen said:
OK, Thanks.

So that code will work with any version of Outlook that
supports the given functionality? 97-2003?

-Andrew Cushen
=======================================================
in message news:[email protected]...
 
Back
Top