![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Need help with powerpoint automation... the script found at msdn scripting guys does end with an error if the option "END WITH BLACK SLIDE" is "NOT" selected in the poperpoint option menue. can anybody help me? tested with pp2003 & pp2007 code http://www.microsoft.com/technet/scr.../ofppvb01.mspx ------------------------------------------------------------------ Const ppAdvanceOnTime = 2 Const ppShowTypeKiosk = 3 Const ppSlideShowDone = 5 Set objPPT = CreateObject("PowerPoint.Application") objPPT.Visible = True Set objPresentation = objPPT.Presentations.Open("C:\test.ppt") objPresentation.Slides.Range.SlideShowTransition.AdvanceTime = 2 objPresentation.Slides.Range.SlideShowTransition.AdvanceOnTime = TRUE objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk objPresentation.SlideShowSettings.StartingSlide = 1 objPresentation.SlideShowSettings.EndingSlide = objPresentation.Slides.Count Set objSlideShow = objPresentation.SlideShowSettings.Run.View Do Until objSlideShow.State = ppSlideShowDone If err Then wscript.echo "Error number " & err & " : " & Err.description Exit Do End If wscript.sleep 20 Loop -------------------------------- after this line an error occurs Error number -2147467259 : SlideShowView.State : Object does not exist. with the option "END WITH BLACK SLIDE" set there ist no problem at all!! please help! |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Need help with powerpoint automation... On Oct 22, 9:47*pm, "reinhold.fied...@xxxxxx" <reinhold.fied...@xxxxxx> wrote: Quote: > the script found at msdn scripting guys does end with an error if the > option "END WITH BLACK SLIDE" is "NOT" selected in the poperpoint > option menue. can anybody help me? > tested with pp2003 & pp2007 > codehttp://www.microsoft.com/technet/scriptcenter/scripts/office/ppt/ofpp.... > > ------------------------------------------------------------------ > Const ppAdvanceOnTime = 2 > Const ppShowTypeKiosk = 3 > Const ppSlideShowDone = 5 > > Set objPPT = CreateObject("PowerPoint.Application") > objPPT.Visible = True > > Set objPresentation = objPPT.Presentations.Open("C:\test.ppt") > > objPresentation.Slides.Range.SlideShowTransition.AdvanceTime = 2 > objPresentation.Slides.Range.SlideShowTransition.AdvanceOnTime = TRUE > > objPresentation.SlideShowSettings.AdvanceMode = ppAdvanceOnTime > objPresentation.SlideShowSettings.ShowType = ppShowTypeKiosk > objPresentation.SlideShowSettings.StartingSlide = 1 > objPresentation.SlideShowSettings.EndingSlide = > objPresentation.Slides.Count > > Set objSlideShow = objPresentation.SlideShowSettings.Run.View > > Do Until objSlideShow.State = ppSlideShowDone > * * * * *If err Then > * * * * * * wscript.echo "Error number " & err & " : " & Err.description > * * * * * * Exit Do > * * * * * * * * End If > * * * * * * * *wscript.sleep 20 > Loop > -------------------------------- > > after this line an error occurs > Error number -2147467259 : SlideShowView.State : Object does not > exist. > with the option "END WITH BLACK SLIDE" set there ist no problem at > all!! > > please help! statement in there for this to work correctly, something like this ... '... On Error Resume Next Do Until objSlideShow.State = ppSlideShowDone If err.Number <> 0 Then ' And I don't think this next line is really necessary (or useful except for debugging) wscript.echo "Error number " & err.Number & " : " & Err.description Exit Do End If wscript.sleep 20 Loop Now it won't show an error, regardless of how the presentation is set up. The error still exists, but is handled by the procedure. Since it's not fatal, it's just ignored. (My other additions are only cosmetic, but I think they make the code more understandable - easing later maintenance.) Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Excel does not die using automation | .NET General | |||
| Powershell OLE Automation? | PowerShell | |||
| Automation error 440 | Vista General | |||
| Excel automation | PowerShell | |||