G
Guest
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 (I naively hardcoded the path) and I also used Shell. Does
anybody have a snipped showing a more efficient method for launching a
Powerpoint file, regardless of which version of Office is running?
My current, ineffecient code:
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
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 (I naively hardcoded the path) and I also used Shell. Does
anybody have a snipped showing a more efficient method for launching a
Powerpoint file, regardless of which version of Office is running?
My current, ineffecient code:
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