Solved

WSH VBscript - How to determine MS Office version ?

Posted on 2004-04-12
6
2,043 Views
Last Modified: 2012-06-27
Using WSH VBscript with MS Word and Outlook.  Need to know what version of Office in use so the "CreateObject" will not fail.  

Example that works with older versions of Outlook:

     Set objOL = CreateObject("Outlook.Application")

Syntax required by Office 2003:

    Set objOL = CreateObject("Outlook.Application.11")

Thanks for any ideas.
0
Comment
Question by:mistert006
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 10808896
This works for me:
Set objOL = CreateObject("Outlook.Application")
Msgbox objOL.version
Set objOL = Nothing
0
 

Author Comment

by:mistert006
ID: 10808913
I need to know the Outlook version before doing the "CreateObject" or it will fail.

Thanks
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 10808937
Good point, don't know.  You may have to search in the registry. Ouch!
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Accepted Solution

by:
zzzzzooc earned 500 total points
ID: 10809110
Registry keys for them would be something such as below..

HKEY_CLASSES_ROOT\Outlook.Application
HKEY_CLASSES_ROOT\Outlook.Application.11

If the key exists, you should be able to create the object. There's also a CurVer sub-key that mentions which CLSID is the current one (updated one).

So within "Outlook.Application", if CurVer says "Outlook.Application.11", then it supports that.


Not sure if this helps or not.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 10809907
"Syntax required by Office 2003:   Set objOL = CreateObject("Outlook.Application.11")"

I have Office 2003 on my PC and I don't have to use that syntax.  The syntax below works just fine.

Set objOL = CreateObject("Outlook.Application")
Wscript.Echo objol.version
Set objOl = Nothing
0
 
LVL 14

Expert Comment

by:aelatik
ID: 10810765
Check it with a function :

If DetermineObject <> "" Then
  Dim X
  Set X = CreateObject(DetermineObject)
  MsgBox X.version
  Set X = Nothing
End If

Function DetermineObject()
  On Error Resume Next
  Dim NEW_OBJ: Set NEW_OBJ = CreateObject("Outlook.Application.11")
  Dim OLD_OBJ: Set OLD_OBJ = CreateObject("Outlook.Application")
  If IsObject(NEW_OBJ) Then
    DetermineObject = "Outlook.Application.11"
  ElseIf IsObject(OLD_OBJ) Then
    DetermineObject = "Outlook.Application"
  Else
    DetermineObject = ""
  End If
End Function
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question