K
Keith
I'm using the following code (Office 2003) to add the contents of the
clipboard to a new slide (saves me a few steps of adding a slide, pasting,
etc.). I'm using this to develop some basic training material with
screenshots of the target application.
However, in order for it to work, I not only have to have powerpoint active,
but actually click in the active document as well- otherwise, it throws an
error (runtime error '-2147188160 (80048240)' View (unknown member): Invalid
request Clipboard is empty or contains data that cannot be pasted here). It
appears that if the slide is selected in the left slides pane, it throws the
error, if the slide itself is active, it pastes just fine.
(1) Can anyone provide a modification to the code below that will
automatically select the active presentation in powerpoint if it isn't
already selected, so I can avoid this error?
(2) I have this code linked to a custom toolbar/button. When in any other
powerpoint presentation (other than my base template) I get a macro warning.
What is the preferred method of setting the template as an add-in (or
something like that) so the macro is always available regardless of what ppt
I have open, and only get the macro warning once when opening powerpoint the
first time?
Thanks!
Keith
'------------------------------------------------------------
Sub addslide()
Dim oView As View
With ActivePresentation.Slides
Set oView = ActiveWindow.View
oView.GotoSlide .Add(oView.Slide.SlideIndex + 1, _
ppLayoutTitleOnly).SlideIndex
Set oView = Nothing
End With
ActiveWindow.View.Paste
End Sub
clipboard to a new slide (saves me a few steps of adding a slide, pasting,
etc.). I'm using this to develop some basic training material with
screenshots of the target application.
However, in order for it to work, I not only have to have powerpoint active,
but actually click in the active document as well- otherwise, it throws an
error (runtime error '-2147188160 (80048240)' View (unknown member): Invalid
request Clipboard is empty or contains data that cannot be pasted here). It
appears that if the slide is selected in the left slides pane, it throws the
error, if the slide itself is active, it pastes just fine.
(1) Can anyone provide a modification to the code below that will
automatically select the active presentation in powerpoint if it isn't
already selected, so I can avoid this error?
(2) I have this code linked to a custom toolbar/button. When in any other
powerpoint presentation (other than my base template) I get a macro warning.
What is the preferred method of setting the template as an add-in (or
something like that) so the macro is always available regardless of what ppt
I have open, and only get the macro warning once when opening powerpoint the
first time?
Thanks!
Keith
'------------------------------------------------------------
Sub addslide()
Dim oView As View
With ActivePresentation.Slides
Set oView = ActiveWindow.View
oView.GotoSlide .Add(oView.Slide.SlideIndex + 1, _
ppLayoutTitleOnly).SlideIndex
Set oView = Nothing
End With
ActiveWindow.View.Paste
End Sub