Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tamar Granor
  Where is Tamar Granor?
 Elkins Park
 Pennsylvania - United States
 Tamar Granor
 To: Matin Aziz
  Where is Matin Aziz?
 New York
 New York - United States
 Matin Aziz
 Tags
Subject: RE: Version of Microsoft Office installed
Thread ID: 345351 Message ID: 345495 # Views: 28 # Ratings: 0
Version: Visual FoxPro 8 Category: Microsoft Office Automation
Date: Wednesday, May 23, 2012 11:04:34 PM         
   


> >
> > The alternative is to find the EXE and check its version. To find the EXE, you have to look for the appropriate server in the Registry. Here's code that looks up the registered server and returns the associated file name. It's based on code in the book Della Martin and I wrote about automating Office:
> >
> >
> > * CheckServer.prg
> > * © 2000, Tamar E. Granor and Della Martin
> > * From:  Microsoft Office Automation with Visual FoxPro
> > * Hentzenwerke Publishing. www.hentzenwerke.com
> > 
> > LPARAMETER cServerName
> > 
> > LOCAL oRegistry, cClassID, cEXEName, lEXEExists, ;
> >       aClassIDValues, aClassIDValues, aServerNameValues
> > 
> >   oRegistry = NewObject("Registry", HOME() + "FFC\Registry")
> > 
> > lEXEExists = .F.
> > DECLARE aClassIDValues[1], aServerNameValues[1]
> > 
> > WITH oRegistry
> > 
> >   * Find the CLSID of the server. First, look for
> >   * the Class's Key.
> >   IF .OpenKey(cServerName + "\CLSID") = 0
> > 
> >     * The Class's Key is open, now enumerate its values
> >     .EnumKeyValues(@aClassIDValues)
> >     
> >     * The data portion of the first (only) value returned
> >     * is the CLSID. Find the LocalServer32 key for the CLSID
> >     IF .OpenKey("CLSID\" + aClassIDValues[1,2] + "\LocalServer32") = 0
> > 
> >       * Enumerate teh LocalServer32 values
> >       .EnumKeyValues(@aServerNameValues)
> >       
> >       * The EXE file is stored in the first (only) data value returned. 
> >       cEXEName = aServerNameValues[2]
> >       
> >       * The value that's returned may have " -Automation" or " /Automation" or
> >       * " /AUTOMATION" & other trailing stuff at the end. Strip it off.
> >       IF "AUTO" $ UPPER(cEXEName)
> >         cEXEName = LEFT(cEXEName, ATC("AUTO", UPPER(cEXEName)) - 2)
> >       ENDIF
> >       
> >     ENDIF     
> >   ENDIF
> > ENDWITH
> > 
> > RETURN m.cEXEName
> > 

> >
> > Once you have the EXE name, just use AGetFileVersion() to look up the version number:
> >
> >
> > AGetFileVersion(aVersionInfo, m.cEXEName)
> > 

> >
> > Tamar
>
>
> Hi Tamar,
> Would this work on a 64 bit version of MS Office? I have a mixture of 32bit and 64bit users and when I run it on the 64bit office it gives the following Error:
> File 'aversioninfo.prg' does not exist.
> it looks like that the "aversioninfo" array is not created.
>

I don't know. It's working for me in Win 7 64-bit, but I'm using the 32-bit version of Office.

Try testing AGetFileVersion() from the Command Window by just giving it the path to the EXE directly. That way, you can see whether that's the problem. If it is, you should be able to find an API function that does the same thing for 64-bit EXEs.

Tamar

ENTIRE THREAD

Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 8:28:03 PM
RE: Version of Microsoft Office installed Posted by Borislav Borissov @ 5/22/2012 8:39:14 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 8:45:00 PM
RE: Version of Microsoft Office installed Posted by Borislav Borissov @ 5/22/2012 8:50:13 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 8:57:56 PM
RE: Version of Microsoft Office installed Posted by Borislav Borissov @ 5/22/2012 9:01:10 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 9:19:14 PM
RE: Version of Microsoft Office installed Posted by Borislav Borissov @ 5/22/2012 9:34:20 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 10:23:22 PM
RE: Version of Microsoft Office installed Posted by Tamar Granor @ 5/22/2012 10:29:34 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 10:52:11 PM
RE: Version of Microsoft Office installed Posted by Borislav Borissov @ 5/22/2012 10:59:33 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/22/2012 11:10:52 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/23/2012 8:57:06 PM
RE: Version of Microsoft Office installed Posted by Tamar Granor @ 5/23/2012 11:04:34 PM
RE: Version of Microsoft Office installed Posted by Matin Aziz @ 5/23/2012 11:19:29 PM
RE: Version of Microsoft Office installed Posted by Tamar Granor @ 5/24/2012 10:27:38 PM