Connecting Tech Pros Worldwide Forums | Help | Site Map

Add reference to Graph.exe for different versions of ms office

Newbie
 
Join Date: Sep 2007
Posts: 1
#1: Sep 11 '07
I'm doing some graph manipulation in VBA, and have made a reference (and am using successfully) the Graph.exe for MS Office. My problem is that I can't be sure exactly what version of Access my end users will be using--or more precisely where their Graph.exe lives. So for some, the reference will point to C:\Program Files\Microsoft Office\OFFICE11\Graph.exe and for others it might be C:\Program Files\Microsoft Office\OFFICE10\Graph.exe. Also what if they didn't install Office to its default location? I'm compiling and releasing an .mde file, but aren't sure how to get around this problem. Thanks in advance, Mike.

msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,886
#2: Sep 12 '07

re: Add reference to Graph.exe for different versions of ms office


Quote:

Originally Posted by mpalazzo

I'm doing some graph manipulation in VBA, and have made a reference (and am using successfully) the Graph.exe for MS Office. My problem is that I can't be sure exactly what version of Access my end users will be using--or more precisely where their Graph.exe lives. So for some, the reference will point to C:\Program Files\Microsoft Office\OFFICE11\Graph.exe and for others it might be C:\Program Files\Microsoft Office\OFFICE10\Graph.exe. Also what if they didn't install Office to its default location? I'm compiling and releasing an .mde file, but aren't sure how to get around this problem. Thanks in advance, Mike.

Hi Mike

You can use this function triggered in a suitable location to determine the version of Access being used. Then use a SELECT CASE statement to determine the path to the Graph.exe

Expand|Select|Wrap|Line Numbers
  1. Function GetVersion() As String
  2.      GetVersion = SysCmd(acSysCmdAccessVer)
  3.  End Function
  4.  
Something like the following for the SELECT CASE statement ...

Expand|Select|Wrap|Line Numbers
  1. Dim version As String
  2.  
  3.     version = GetVersion
  4.  
  5.     SELECT CASE version
  6.  
  7.     Case "10.0"
  8.         path = "C:\Program Files\Microsoft Office\OFFICE10\Graph.exe."
  9.     Case ....etc.
  10.  
  11.     END SELECT
  12.  
These are the versions:

8.0 = Access 97
9.0 = Access 2000
10.0 = Access 2002(XP)
11.0= Access 2003
12.0= Access 2007
Reply