Outlook 11.0 Library

B

Bret

I have an Excel VBA program that is distributed throughout our company
nationally (1000 users). One of the features is ability for user to click a
button and it opens up Outlook with Send to, Subject and a message all filled
in and user can of course just click the SEND button.
It works for majority of users who have Outlook 2003 however a large portion
of users have older Outlook versions that creates a compile error or missing
Reference errors, again program uses Outlook 11.0 library.
What can be done in code or with references so this feature works with all
users who either have Outlook 2003 or the version before this?

thanks
 
C

Chip Pearson

I think in this case you are stuck with using late binding.
Change all your Outlook type variables to simple Objects, e.g.,
change
Dim AddrEntry As Outlook.AddressEntry
to
Dim AddrEntry As Object

and create the Outlook Application using CreateObject or
GetObject.

Dim OL As Object
On Error Resume Next
Set OL = GetObject(, "Outlook.Application")
If OL Is Nothing Then
Set OL = CreateObject("Outlook.Application")
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
C

Chip Pearson

I should have added that you should use only those objects,
methods, and properties that are present in the earliest version
of Outlook that you need to support. In other words, don't use
any new in Outlook 11.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
B

Bret

Chip,
thank you thank you for your expertise, Please, what would be used in
place of the Outlook.Mailitem & Create.Item as shown below?

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)

thank you again for your help...
 
C

Chip Pearson

Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem

would be

Dim OutApp As Object
Dim OutMail As Object

In general, where ever you have a variable Dim'd as As
Outlook.whatever, change it to As Object.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
T

Trefor

Ron,

Is it possible to check if Outlook is actually installed (via VBA) without
running into the Reference error?
 
N

NickHK

If you are using Late Binding:
On Error Resume Next
Set OutlookApp=CreateObject("Outlook.Application")
If OutlookApp Is Nothing Then
'Can't create Outlook. Not installed or other error
Exit Sub
End If

NickHK
 
T

Trefor

Nick, Great many thanks
--
Trefor


NickHK said:
If you are using Late Binding:
On Error Resume Next
Set OutlookApp=CreateObject("Outlook.Application")
If OutlookApp Is Nothing Then
'Can't create Outlook. Not installed or other error
Exit Sub
End If

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top