Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

extract powerpoint slide image and speaker notes

9 views
Skip to first unread message

Michael Brown

unread,
May 28, 2003, 7:27:49 PM5/28/03
to
Can some kind soul point me to sample VBA/C# code to extract the speaker
notes for the current slide in a PowerPoint 2002 presentation?

Also could use a sample to grab the currently projected slide image.

Thanks so much...

Mike


Steve Rindsberg

unread,
May 28, 2003, 11:20:26 PM5/28/03
to
This is sorta crude, but it'll generally work for simple presentations:

Dim sh As Shape

For Each sh In ActivePresentation.Slides(1).NotesPage.Shapes
If sh.HasTextFrame Then
If sh.TextFrame.HasText Then
MsgBox sh.TextFrame.TextRange.Text
End If
End If
Next sh

--

Steve Rindsberg PPT MVP
PPTLive ( http://www.pptlive.com ) Featured Speaker
CorelWorld ( http://www.corelworld.com ) Featured Speaker
PPTools: http://www.pptools.com
PPT FAQ: http://www.pptfaq.com


"Michael Brown" <m...@NOSPAM.purdue.edu> wrote in message
news:O9u5eDXJ...@TK2MSFTNGP11.phx.gbl...

Michael Brown

unread,
May 29, 2003, 12:46:28 AM5/29/03
to
Thanks very much, Steve. It's a bit uglier in C#, but I managed to
translate it:

foreach (PowerPoint.Shape sh in
ppPres.Slides.Range(curSlide).NotesPage.Shapes)
if (MsoTriState.msoTrue == sh.HasTextFrame)
if (MsoTriState.msoTrue == sh.TextFrame.HasText)
Console.WriteLine(sh.TextFrame.TextRange.Text);

So what do you mean by "simple" presentations? What would cause this to
fail? Can there be multiple text frames on a slide's notes page?

Mike

"Steve Rindsberg" <ab...@localhost.com> wrote in message
news:Oq2a1GZ...@tk2msftngp13.phx.gbl...

Steve Rindsberg

unread,
May 29, 2003, 11:08:17 AM5/29/03
to
> So what do you mean by "simple" presentations? What would cause this to
> fail? Can there be multiple text frames on a slide's notes page?

There can only be one notes text frame, but there could be any number of
other shapes with text on the notes page as well. You can draw on it just
as you would a slide.

If somebody knows a way of distinguishing the notes text object from the
other shapes, I'd *love* to know about it.

In a newly created presentation, it'll always have the same name, but you
can't rely on that. If the user deletes and recreates the notes or copies
from one slide to the next, the name of the notes text shape will change.

Are we having fun yet? ;-)

Shyam

unread,
May 29, 2003, 11:19:12 AM5/29/03
to
Steve,

> If somebody knows a way of distinguishing the notes text object from the
> other shapes, I'd *love* to know about it.
Care to elaborate?

Regards
Shyam Pillai

"Steve Rindsberg" <ab...@localhost.com> wrote in message

news:eJdyYSfJ...@TK2MSFTNGP10.phx.gbl...

Shyam

unread,
May 29, 2003, 11:54:28 AM5/29/03
to
Steve,
Are looking for something like this? This would be a weird coincidence since
exactly a year ago on this date I posted a similar code snippet to check the
very same thing in response to your post. : )

' ----- Beginning Of Code -----
Option Explicit
Const ERR_MSG = "Shape (unknown member) : Invalid request. Not valid for
notes or handout masters."

Function IsShapeOnSlide(oShp As Shape) As Boolean
On Error GoTo ErrHandler
Dim oAS As ActionSetting
Set oAS = oShp.ActionSettings(ppMouseClick)
IsShapeOnSlide = True
Set oAS = Nothing
Exit Function
ErrHandler:
If Err.Description = ERR_MSG Then
IsShapeOnSlide = False
Else
IsShapeOnSlide = True
End If
End Function

Sub Test()
Debug.Print IsShapeOnSlide(ActiveWindow.Selection.ShapeRange(1))
End Sub
' ----- End Of Code -----


--
Regards
Shyam Pillai

Handout Wizard
http://www.mvps.org/skp/how/

"Steve Rindsberg" <ab...@localhost.com> wrote in message

news:eJdyYSfJ...@TK2MSFTNGP10.phx.gbl...

Steve Rindsberg

unread,
May 29, 2003, 3:22:01 PM5/29/03
to
You're the one with the photographic memory, my friend, not I. ;-)
But this returns false when I have notes text selected, so I don't think it
solves the problem.

That had me poking at things and it occurred to me:

Sub IsItNotesText()

Dim sh As Shape
Set sh = ActiveWindow.Selection.ShapeRange(1)

If sh.PlaceholderFormat.Type = ppPlaceholderBody Then
MsgBox "It's body text, so if this is a notes page, this is the notes
text. Case closed."
Else
MsgBox "It's something else."
End If

End Sub

So simple ...


--

Steve Rindsberg PPT MVP
PPTLive ( http://www.pptlive.com ) Featured Speaker
CorelWorld ( http://www.corelworld.com ) Featured Speaker
PPTools: http://www.pptools.com
PPT FAQ: http://www.pptfaq.com


"Shyam" <Sh...@Asia.com> wrote in message
news:uuvUaqfJ...@tk2msftngp13.phx.gbl...

Shyam

unread,
May 29, 2003, 4:08:15 PM5/29/03
to
Hi Steve,
The function is working as expected. When you have notes text selected, it
will return FALSE since the shape is not on a slide but on the notes page.
It will return TRUE for a shape on the slide.

Regards
Shyam Pillai

"Steve Rindsberg" <ab...@localhost.com> wrote in message

news:eyRaKghJ...@TK2MSFTNGP11.phx.gbl...

Steve Rindsberg

unread,
May 29, 2003, 8:25:40 PM5/29/03
to
"Shyam" <Sh...@Asia.com> wrote in message
news:#spFQ4hJ...@TK2MSFTNGP10.phx.gbl...

> Hi Steve,
> The function is working as expected. When you have notes text selected, it
> will return FALSE since the shape is not on a slide but on the notes page.
> It will return TRUE for a shape on the slide.

Are we talking at cross purposes? I was looking for a way to find out
whether a given shape was the notes text placeholder.

Shyam

unread,
May 29, 2003, 10:09:47 PM5/29/03
to
Hi Steve,
If you just want to check if the shape is the Notes body placeholder then
the PlaceholderType will give the information. I thought you wanted to
ascertain that if a given shape was on the notes page or not.


--
Regards
Shyam Pillai

Shyam's Toolbox for PowerPoint
http://www.mvps.org/skp/toolbox


"Steve Rindsberg" <ab...@localhost.com> wrote in message

news:eQ#x1JkJD...@TK2MSFTNGP12.phx.gbl...

Steve Rindsberg

unread,
May 30, 2003, 11:00:10 AM5/30/03
to
> If you just want to check if the shape is the Notes body placeholder then
> the PlaceholderType will give the information. I thought you wanted to
> ascertain that if a given shape was on the notes page or not.

Yup, that's what I arrived at (and realized later had worked out long ago
... it was a long day <g>)

0 new messages