Best way to determine installed version of MS Office
- From: GeorgeAtkins <GeorgeAtkins@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Jun 2007 07:52:03 -0700
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
.
- Follow-Ups:
- Re: Best way to determine installed version of MS Office
- From: Karl E. Peterson
- Re: Best way to determine installed version of MS Office
- From: MikeD
- Re: Best way to determine installed version of MS Office
- Prev by Date: Re: "space" in hex?
- Next by Date: Re: Best way to determine installed version of MS Office
- Previous by thread: "space" in hex?
- Next by thread: Re: Best way to determine installed version of MS Office
- Index(es):
Relevant Pages
|