Checking Application version

StuLux

Well-known Member
Joined
Sep 14, 2005
Messages
679
Office Version
  1. 365
Platform
  1. Windows
I use the following code from Excel to check which version of Office is being used and then use the appropriate PowerPoint version. For development purposes I have now installed both Excel 2003 and Excel 2007 on my PC so the code no longer works as I only have PowerPoint 2007 i.e. the code identifies that I am using Excel 2003 and then tries to open PowerPoint 2003 and fails. Can anybody help me adapt this code so it actually checks what version of PowerPoint is installed rather than checking what version of Excel is being used?

Code:
 'Start PowerPoint
        If Application.Version = 11# Then
        PPOpen = Shell("C:\Program Files\Microsoft Office\Office11\POWERPNT.EXE", 1)
        Else
        PPOpen = Shell("C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE", 1)
        End If
        Set PPApp = CreateObject("Powerpoint.Application")
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hello Stuart

Possibly:

Code:
'Start PowerPoint
     If Len(Dir("C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE"))>0 Then
         PPOpen = Shell("C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE", 1)
     Else
        PPOpen = Shell("C:\Program Files\Microsoft Office\Office11\POWERPNT.EXE", 1)
     End If
 
Upvote 0
Thanks Rich, managed to work out a solution as follows, yours is shorter and neater.

Code:
'Check which version of PowerPoint to use
    Dim FilePath As String
    Dim TestStr As String
    'Look for existence of PowerPoint 2003
    FilePath = "C:\Program Files\Microsoft Office\Office11\POWERPNT.EXE"
    TestStr = ""
    On Error Resume Next
    TestStr = Dir(FilePath)
    On Error GoTo 0
    If TestStr = "" Then
    'PowerPoint 2003 does not exist - use PowerPoint 2007
        PPOpen = Shell("C:\Program Files\Microsoft Office\Office12\POWERPNT.EXE", 1)
    Else
    'PowerPoint 2003 does exist so use it
        PPOpen = Shell("C:\Program Files\Microsoft Office\Office11\POWERPNT.EXE", 1)
    End If
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top