Link to home
Start Free TrialLog in
Avatar of SiM99
SiM99

asked on

Getting the version of Office (Access), if installed

How can I get the version of an installed MS Office, if it exists, that is...

Up to now I'm checking the following reg key exists, assuing this will only be there if office is installed:
HKEY_LOCAL_MACHINE\Software\Microsoft\Office

I've seen some other answers to this question in PAQs, but I'm not going to accept those answers if they are re-submitted for my question.

E.G.:
(assuming there's already a this line of code: "Dim A as Access.Application")

Checking A.Version doesnt work - there is no version property of that object.

Checking A.CurrentDB.Version - nope!, there has to be a database open and I can't open it if they have Access 97 (which is why I want this version checker :)

I think that's all... thanks! :)
SiM99
Avatar of inthedark
inthedark
Flag of United Kingdom of Great Britain and Northern Ireland image

Do you have VB6?
' Set a reference to MS DAO V 3.6+

' Using this option does not need to open a database

msgbox FindInstalledVersion()


4.0 = 2000
3.0 = 95/97
2.0 = Access V2
1.1 = Access V1.1
1.0 = Access V1.0

Hope this helps.........


Function FindInstalledVersion()

Dim ver$
dim tmp$
dim db=dao.database
tmp$ = App.Path + "dummy.mdb"
Set db = Workspaces(0).CreateDatabase(tmp$, dbLangGeneral)
ver$ = db.Version
db.Close
set db=nothing
DoEvents
Kill tmp$
FindInstalledVersion=ver$

End Function
dim db As DAO.database ' would be better than dim db=dao.database

ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
maybe this could help:

Private Sub Form_Load()
On Error Resume Next
Dim a As Object
Set a = CreateObject("access.application")
If Err.Number <> 0 Then
    MsgBox "Access is not installed"
    Err.Clear
Else
    MsgBox a.dbengine.properties("version")
    a.quit
    Set a = Nothing
   
End If
   
End Sub
Avatar of SiM99
SiM99

ASKER

Ive given each method a test

From inthedark's method, I get 4.0, which as he said is access 2000. That works, but I didn't want to open a database because that's extra processing time (aswell as the fact it wouldnt open in 97) so creating one will also take that extra time... if not more.

The code from Richie_Simonetti gave 3.6, and I have absolutely no idea what that would mean :)

bruintje's mention of the registry value in HKEY_CLASSES_ROOT was really what I was looking for.

Thanks for the feedback.
Sorry it took so long for me to accept an answer, havent looked at EE for a while.
Thanks for your reply. it is nice to see another comment from asker when question is finished.
Cheers