Adding comments to pasted slide with VBA

K

Keith R

I'm adapting some existing code, because I need to be able to make a few
notes to myself when using this macro to paste screenshots while developing
training material (to keep track of what user actions occurred right before
the screen shot, etc.). I've tried to edit it to allow the user to input
some text and paste it into the slide that was just pasted in, but it isn't
working- I get a runtime error that "selection (unknown member): invalid
request. Nothing appropriate is selected"

Can anyone help me with the syntax?
Many thanks,
Keith

Sub addslide()

Dim oSld As Slide

With ActivePresentation.Slides

Set oSld = ActiveWindow.Selection.SlideRange(1)
With .Add(oSld.SlideIndex + 1, ppLayoutTitleOnly)
.Shapes.Paste

TempComment = InputBox ("Enter your slide comments:", "Comments")
ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Select '*** this
is the line it stops on
With ActiveWindow.Selection.TextRange
.Text = TempComment
End With

End With
End With


End Sub
 
K

Keith R

On the line marked below, I get a "runtime error (unknown member): invalid
request. This type of shape cannot have a TextRange"
I'm using PP2003 on WinXP, if that helps. I open the .ppt with this code, do
a screenshot, then activate the code by clicking on a toolbar button that is
linked to the macro.

Steve, I'm not familiar with the PP object model; is the code below intended
to add the text to the actual comments field of the slide, or to add a new
shape to the slide itself (and add text)? I looked to see if I could find
any other shapes being added to the slide, but I wasn't able to find
anything other than the default empty title box behind the screenshot. My
preference would be to add the comments to the comment field rather than on
the slide itself, but honestly, I'll be pleased with anything I can get :)

Thanks!
Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top