In een Powerpoint presentatie heb ik onderstaande code verwerkt.
Het idee is dat bij de eerste dia een applicatie gestopt wordt.
Bij een volgende dia wordt deze weer gestart.
De code wordt correct uitgevoerd indien de presentatie handmatig wordt gestart (F5).
Echter, indien de presentatie wordt opgeslagen als voorstelling (met ingeschakelde macro's), dan wordt de code niet uitgevoerd.
Iemand enig idee waarom dit niet werkt? Het betreft hier Office 2007.
Dim oShell
Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = _
SSW.Presentation.SlideShowSettings.StartingSlide Then
' If SSW.View.CurrentShowPosition = 1 Then
' MsgBox "First slide in the slide show"
Dim sKillExcel As String
sKillExcel = "TASKKILL /F /IM notepad.exe"
Shell sKillExcel, vbHide
End If
If SSW.View.CurrentShowPosition = 2 Then
' MsgBox "Second slide in the slide show"
Dim RetVal As Long
On Error Resume Next
RetVal = ShellExecute(0, "open", "notepad.exe", "<arguments>", _
"<run in folder>", SW_SHOWMAXIMIZED)
End If
End Sub
Het idee is dat bij de eerste dia een applicatie gestopt wordt.
Bij een volgende dia wordt deze weer gestart.
De code wordt correct uitgevoerd indien de presentatie handmatig wordt gestart (F5).
Echter, indien de presentatie wordt opgeslagen als voorstelling (met ingeschakelde macro's), dan wordt de code niet uitgevoerd.
Iemand enig idee waarom dit niet werkt? Het betreft hier Office 2007.
Dim oShell
Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3
Public Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
If SSW.View.CurrentShowPosition = _
SSW.Presentation.SlideShowSettings.StartingSlide Then
' If SSW.View.CurrentShowPosition = 1 Then
' MsgBox "First slide in the slide show"
Dim sKillExcel As String
sKillExcel = "TASKKILL /F /IM notepad.exe"
Shell sKillExcel, vbHide
End If
If SSW.View.CurrentShowPosition = 2 Then
' MsgBox "Second slide in the slide show"
Dim RetVal As Long
On Error Resume Next
RetVal = ShellExecute(0, "open", "notepad.exe", "<arguments>", _
"<run in folder>", SW_SHOWMAXIMIZED)
End If
End Sub