View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sophie Sophie is offline
external usenet poster
 
Posts: 15
Default Outlook - Different Versions

Hello Everyone!

I'm sending out a spreadsheet with some code which people
will run to email me back. Sometimes it crashes because
everyone out there has a different version of Outlook.

I've had a good look through the postings on here and
think it's because the reference files are different.
I've got a found function that will tell me what version
everyone out there is using. But I don't know what to do
then?

I think it's one of the posts but it's just too
complicated for me, I'm new to VB.

My code is below.

If anyone could help I'd be very grateful

Sxx

Sub SimpleSender()

CheckOLVersion

MsgBox CheckOLVersion

Dim objOutlook As New Outlook.Application
Dim objOutlookMsg As Outlook.MailItem


'Open Outlook
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg

.Display
.Recipients.Add "Sophie"
.subject = "Tester"
.Body = "Here I am"
'.Send

End With

Set objOutlook = Nothing


End Sub
Function CheckOLVersion() ' As String
Dim objOL ' As Outlook.Application
Dim strVersion ' As String
Dim arrVer
On Error Resume Next

Set objOL = CreateObject("Outlook.Application")
strVersion = objOL.Version
If Err Then
' Outlook 97
CheckOLVersion = "97"
Exit Function
End If

arrVer = Split(strVersion, ".")
Select Case CInt(arrVer(0))
Case 8 ' Outlook 98
CheckOLVersion = "98"
Case 9 ' Outlook 2000
CheckOLVersion = "2000"
Case 10 ' Outlook 2002
CheckOLVersion = "2002"
Case 11 ' Outlook 2003
CheckOLVersion = "2003"
End Select
Set objOL = Nothing
End Function