473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Multiple Versions of Outlook

Hi all,

I have a database being used by 30 people and is split between the
backend and frontend. The database has the ability to send e-mails
through Outlook and I have even put Redemption on people's PCs as to
not get all the Outlook security prompts. Here's the problem: Half
are using Outlook 2003, the other half is using Outlook 2007, and 1 is
using Outlook XP. I am using Outlook 2007, so my reference is set to
use Microsoft Outlook 12.0, but other people need Outlook 11.0

Can I programmatically have the database detect what type of Outlook
is on the PC and set the reference accordingly?

Thanks in advance,
Laura
Nov 19 '08 #1
4 5121
On Nov 19, 5:09*pm, musicloverlch <lho...@gmail.comwrote:
Hi all,

I have a database being used by 30 people and is split between the
backend and frontend. *The database has the ability to send e-mails
through Outlook and I have even put Redemption on people's PCs as to
not get all the Outlook security prompts. *Here's the problem: Half
are using Outlook 2003, the other half is using Outlook 2007, and 1 is
using Outlook XP. *I am using Outlook 2007, so my reference is set to
use Microsoft Outlook 12.0, but other people need Outlook 11.0

Can I programmatically have the database detect what type of Outlook
is on the PC and set the reference accordingly?

Thanks in advance,
Laura
Hi Laura,

I know about the issue using different versions of Outlook and usually
client agree to use only one version. However, here are couple of
ideas which I didn't try yet, but I think it might work.

Reference can be set programmatically with:

Application.References.AddFromFile FileName

Where FileName is Outlook DLL.

A better option might be not to use the reference if possible.
Actually I have found advice some time ago, but I don't know the
author nor it will work with Outlook. Following solution is for MS
Word reference:

-----
You can declare your word object as a generic object and then use the
CreateObject method.

So this

Dim WordApp as Word.Application
Set WordApp = New Word.Application

Would become

Dim WordApp as Object
Set WordApp = CreateObject("Word.Application")
----

This works with Word, as told, but you can give a try with Outlook.

If you have issues, let me know and I will give a try to make it work.

Regards,
Branislav Mihaljev
Microsoft Access MVP
Nov 20 '08 #2
On Nov 20, 12:42*pm, ban...@gmail.com wrote:
On Nov 19, 5:09*pm, musicloverlch <lho...@gmail.comwrote:
Hi all,
I have a database being used by 30 people and is split between the
backend and frontend. *The database has the ability to send e-mails
through Outlook and I have even put Redemption on people's PCs as to
not get all the Outlook security prompts. *Here's the problem: Half
are using Outlook 2003, the other half is using Outlook 2007, and 1 is
using Outlook XP. *I am using Outlook 2007, so my reference is set to
use Microsoft Outlook 12.0, but other people need Outlook 11.0
Can I programmatically have the database detect what type of Outlook
is on the PC and set the reference accordingly?
Thanks in advance,
Laura

Hi Laura,

I know about the issue using different versions of Outlook and usually
client agree to use only one version. However, here are couple of
ideas which I didn't try yet, but I think it might work.

Reference can be set programmatically with:

Application.References.AddFromFile FileName

Where FileName is Outlook DLL.

A better option might be not to use the reference if possible.
Actually I have found advice some time ago, but I don't know the
author nor it will work with Outlook. Following solution is for MS
Word reference:

-----
You can declare your word object as a generic object and then use the
CreateObject method.

So this

Dim WordApp as Word.Application
Set WordApp = New Word.Application

Would become

Dim WordApp as Object
Set WordApp = CreateObject("Word.Application")
----

This works with Word, as told, but you can give a try with Outlook.

If you have issues, let me know and I will give a try to make it work.

Regards,
Branislav Mihaljev
Microsoft Access MVP
Oh, I forgot. To remove reference programmatically use:

Application.References.Remove FileName

I assume you can test to see if DLL file exists with:

If Len(Dir(FileName)) 0 and then use Remove/AddFromFile commands.

Regards,
Branislav Mihaljev
Microsoft Access MVP
Nov 20 '08 #3

"musicloverlch" <lh****@gmail.comwrote in message
news:c2**********************************@f40g2000 pri.googlegroups.com...
Hi all,

I have a database being used by 30 people and is split between the
backend and frontend. The database has the ability to send e-mails
through Outlook and I have even put Redemption on people's PCs as to
not get all the Outlook security prompts. Here's the problem: Half
are using Outlook 2003, the other half is using Outlook 2007, and 1 is
using Outlook XP. I am using Outlook 2007, so my reference is set to
use Microsoft Outlook 12.0, but other people need Outlook 11.0

Can I programmatically have the database detect what type of Outlook
is on the PC and set the reference accordingly?

Thanks in advance,
Laura
Look at the difference between Early and Late Binding. You are using early
binding which requires a reference to Outlook. the following function uses
late binding to create and preview or send a email using Outlook. Preview
does NOT cause the security warning. With late binding, you will need to
declare any constants you wish to use.

'---------------------
' Create a email with attachments
' stSendTo Email address
' stBody Body of the message
' stSubject Subject of the message
' astAttach Array of strings listing the path to the attachments
' intAcount Number of attachments
' intSend True if the message should be sent without preview

Public Function EmailAttach(ByRef stSendTo As String, ByRef stBody As
String, ByRef stSubject As String, _
astAttach() As String, intAcount As
Integer, intSend As Integer) As Integer

On Error GoTo errEmailAttach

Dim oLook As Object
Dim oMail As Object
Dim i As Integer

Set oLook = CreateObject("Outlook.Application")
Set oMail = oLook.CreateItem(0)
With oMail
.To = stSendTo
.Body = stBody
.Subject = stSubject
.ReadReceiptRequested = True

If intAcount <0 Then
For i = 1 To intAcount
.Attachments.Add (astAttach(i - 1))
Next
End If

If intSend = True Then
.Send
Else
.Display
End If

End With

Set oMail = Nothing
Set oLook = Nothing
EmailAttach = True
Exit Function

errEmailAttach:

MsgBox "The following error was noted : " & Err.Description & Chr$(10) &
Chr$(13) & _
"Your email may not have been sent.", vbCritical, "Error"

On Error Resume Next
Set oMail = Nothing
Set oLook = Nothing
EmailAttach = False

End Function
Nov 20 '08 #4
Thanks for all your advice. I actually found something really cool on
experts-exchange after I read all the (very boring) stuff about early
vs late binding. This works great!:
Dim theRef As Variant, i As Long
Dim ref As Reference, strPath98 As String, strPath00 As String
Dim strPathXP As String, strPath03 As String, strPath07 As String
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")

'Update the GUID you need below.
strPath98 = "C:\Program Files\Microsoft Office\Office
\msoutl85.olb"
strPath00 = "C:\Program Files\Microsoft Office\Office\msoutl9.olb"
strPathXP = "C:\Program Files\Microsoft Office
\Office10\msoutl.olb"
strPath03 = "C:\Program Files\Microsoft Office
\OFFICE11\msoutl.olb"
strPath07 = "C:\Program Files\Microsoft Office
\OFFICE12\msoutl.olb"

'Set to continue in case of error
On Error Resume Next

'Remove any missing references
For i = 1 To Application.References.Count
Set theRef = Application.References.Item(i)
If theRef.IsBroken = True Then
Application.References.Remove (theRef)
End If
Next i

'Clear any errors so that error trapping for GUID additions can
be evaluated
Err.Clear

'Add the reference
If fs.FileExists(strPath07) Then
Application.References.AddFromFile strPath07
ElseIf fs.FileExists(strPath98) Then
Application.References.AddFromFile strPath98
ElseIf fs.FileExists(strPath03) Then
Application.References.AddFromFile strPath03
ElseIf fs.FileExists(strPath00) Then
Application.References.AddFromFile strPath00
ElseIf fs.FileExists(strPathXP) Then
Application.References.AddFromFile strPathXP
End If

'If an error was encountered, inform the user
Select Case Err.Number
Case Is = 32813
'Reference already in use. No action necessary
Case Is = vbNullString
'Reference added without issue
Case Else
'An unknown error was encountered, so alert the user
MsgBox "A problem was encountered trying to" & vbNewLine _
& "add or remove a reference in this file" & vbNewLine &
"Please check the " _
& "references in your VBA project!", vbCritical + vbOKOnly,
"Error!"
End Select
On Error GoTo 0
End Sub

On Nov 20, 7:10*am, "paii, Ron" <n...@no.comwrote:
"musicloverlch" <lho...@gmail.comwrote in message

news:c2**********************************@f40g2000 pri.googlegroups.com...
Hi all,
I have a database being used by 30 people and is split between the
backend and frontend. *The database has the ability to send e-mails
through Outlook and I have even put Redemption on people's PCs as to
not get all the Outlook security prompts. *Here's the problem: Half
are using Outlook 2003, the other half is using Outlook 2007, and 1 is
using Outlook XP. *I am using Outlook 2007, so my reference is set to
use Microsoft Outlook 12.0, but other people need Outlook 11.0
Can I programmatically have the database detect what type of Outlook
is on the PC and set the reference accordingly?
Thanks in advance,
Laura

Look at the difference between Early and Late Binding. You are using early
binding which requires a reference to Outlook. the following function uses
late binding to create and preview or send a email using Outlook. Preview
does NOT cause the security warning. With late binding, you will need to
declare any constants you wish to use.

'---------------------
' Create a email with attachments
' * stSendTo * * * Email address
' * stBody * * * * Body of the message
' * stSubject * * *Subject of the message
' * astAttach * * *Array of strings listing the path to the attachments
' * intAcount * * *Number of attachments
' * intSend * * * *True if the message should be sent without preview

Public Function EmailAttach(ByRef stSendTo As String, ByRef stBody As
String, ByRef stSubject As String, _
* * * * * * * * * * * * * * * * *astAttach() As String, intAcount As
Integer, intSend As Integer) As Integer

* * On Error GoTo errEmailAttach

* * Dim oLook As Object
* * Dim oMail As Object
* * Dim i As Integer

* * Set oLook = CreateObject("Outlook.Application")
* * Set oMail = oLook.CreateItem(0)
* * * * With oMail
* * * * * * .To = stSendTo
* * * * * * .Body = stBody
* * * * * * .Subject = stSubject
* * * * * * .ReadReceiptRequested = True

* * * * * * If intAcount <0 Then
* * * * * * * * For i = 1 To intAcount
* * * * * * * * * * .Attachments.Add (astAttach(i - 1))
* * * * * * * * Next
* * * * * * End If

* * * * * * If intSend = True Then
* * * * * * * * .Send
* * * * * * Else
* * * * * * * * .Display
* * * * * * End If

* * * * End With

* * Set oMail = Nothing
* * Set oLook = Nothing
* * EmailAttach = True
* * Exit Function

errEmailAttach:

* * MsgBox "The following error was noted : " & Err.Description & Chr$(10) &
Chr$(13) & _
* * * * * *"Your email may not have been sent.", vbCritical, "Error"

* * On Error Resume Next
* * Set oMail = Nothing
* * Set oLook = Nothing
* * EmailAttach = False

End Function
Nov 20 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Saintor | last post by:
On a local network, I have OFF2K and OFF XP. When I set it up, it was with XP and required Outlook library v10. Of course, it fails when open on a workstation with v9. Is there a way at db...
9
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and...
5
by: | last post by:
Hi all, HttpWebRequest, and SoapHttpClientProtocol both expose a ClientCertificates property, which can hold multiple client certificates, but on the service side, it can only receive one client...
17
by: John | last post by:
Hi I need to package one of my access apps and send to clients. My app calls outlook to send emails. The problem is that client pcs can each have a different version of outlook (2000, xp, 2003...
3
by: wizzbangca | last post by:
Hi everyone. Having problems with a utility I am writing for work. The previous IT Director thoughtfully allowed 3 (2000, xp, 2003) versions of outlook to be installed rather than 1. Now I need...
3
by: AP | last post by:
I have an app that has one small component that uses a reference to MS Outlook 9.0 to create an email. Now we have users on 9.0 and 11.0, sometimes it causes the reference to switch and this causes...
2
by: Kosmos | last post by:
Alright so I've got this Outlook code written in VBA in Access. The first part, which works, records information about appointment times based on the required days before notification of certain...
46
by: Phil Reynolds | last post by:
I have Access 2000 and 2003 on my development machine. My client only has Access 2000. When I develop for this client, I run Access 2000. However, my code requires that I have the Microsoft Word...
3
by: Chet | last post by:
I am writing an application that utilizes a reference to Microsoft Outlook. (Added a reference to the MS Outlook COM interface to my project). I then write code such as: dim olApp as new...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.