Best way to determine installed version of MS Office



Greetings,
I wrote a small Exe that simply runs Shell to load PowerPoint and launch a
particular file, depending on the day of the week. However, it was set up for
office 2003 (hardcoded path). I now want to have the program run the Shell
for either Office 11 or Office 12, depending upon which version is installed
on a desktop. What is the most efficient way to code this?

My code is as follows:
Sub main()
Try
Dim ps1 As New PermissionSet(PermissionState.Unrestricted)
ps1.Demand()
Dim MyDate As Date
Dim DayOfWeek As Integer

MyDate = Today
DayOfWeek = Weekday(MyDate)

' Launch the powerpoint file for the current day of the week.
Select Case DayOfWeek
Case 1
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Sunday.ppt""")
Case 2
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Monday.ppt""")
Case 3
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Tuesday.ppt""")
Case 4
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Wednesday.ppt""")
Case 5
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Thursday.ppt""")
Case 6
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Friday.ppt""")
Case 7
Shell("""C:\Program Files\Microsoft
Office\OFFICE11\powerpnt.exe"" /s " & Chr(34) + CurDir() & "\Saturday.ppt""")
End Select
Catch e As SecurityException
MsgBox(e.Message)
End Try
End
End Sub

Thanks for any advise!
George Atkins
.



Relevant Pages

  • Re: Best way to determine installed version of MS Office
    ... depending on the day of the week. ... I now want to have the program run the Shell ... ' Launch the powerpoint file for the current day of the week. ...
    (microsoft.public.vb.syntax)
  • Re: [Full-Disclosure] shell:windows command question
    ... shell:.its will launch Internet Explorer ... Windows XP pro + FireFox 0.9.1 ... You will find the shell object calls Windows ...
    (Full-Disclosure)
  • Re: Custom Shell Running Twice On Boot
    ... I suspected FBA is the one who launches your shell twice. ... > Tomer. ... >> Regarding the shell double launch - confusing. ...
    (microsoft.public.windowsxp.embedded)
  • Re: Sucking back your stern
    ... Boat Race umpires are particularly prone to sternly ... From my observation of leaning over the front of a launch, ... water in front of the launch is about six inches, ... vacuum closeup behind the shell again before the bow wave form the ...
    (rec.sport.rowing)
  • Re: [opensuse] Process launching directory
    ... I launch the program from the shell and I was looking ... You can find the current working directory of the process, ... If the parent process is the KDE or gnome menus, ...
    (SuSE)