Extract text from slides and insert into notes section

P

pptman

Hello,

I know there've been numerous posts regarding extraction of text from
the slides and whatnot, but what I'm interested in doing is extracting
the text from slides and then inserting that text into the notes
section of the slide.

I want to take notes for class, but I also want to be able to export
the notes section to MS Word and just print out the notes, not the
slides...

If anyone could point me to a program that can do this, I'd be greatly
appreciated, as I do not have any programming experience. Thank you!
 
S

Steve Rindsberg

I know there've been numerous posts regarding extraction of text from
the slides and whatnot, but what I'm interested in doing is extracting
the text from slides and then inserting that text into the notes
section of the slide.

I want to take notes for class, but I also want to be able to export
the notes section to MS Word and just print out the notes, not the
slides...

Search http://www.pptfaq.com for terms like "text"

There are a couple of macros that export slide text and/or notes text to text
files. You could run those, then open the text file in Word.
 
P

pptman

But there would be no way to insert text from the slides into the notes
section of the powerpoint itself?
 
S

Steve Rindsberg

But there would be no way to insert text from the slides into the notes
section of the powerpoint itself?

It could be done and wouldn't take too great an adaptation of the code in the
link I posted earlier; I just haven't the time to do it at the moment, though.
 
P

pptman

Would anyone else have the time to help me with this problem right now,
please?

Thank you!
 
P

pptman

I pasted some snippets of code together and got this:

======
Sub ExportAllSlideText()
Dim oSlide As Slide
Dim oShape As Shape

' Interate thru each slide in the presentation
For Each oSlide In ActivePresentation.Slides

' Interate thru each shape in the current slide
For Each oShape In oSlide.Shapes

' Check if the current shape has a text frame
If oShape.HasTextFrame Then

' Check if the text frame has text in it.
If oShape.TextFrame.HasText Then
With ActivePresentation.Slides(oSlide). _
NotesPage.Shapes(2).TextFrame.TextRange
Text = .Text & vbCr & oShape.TextFrame.TextRange.Text

End With
End If
End If
Next oShape

'Next slide
Next oSlide

'End routine
End Sub
======

What's wrong? The error message I get is: "Slides (unknown member): Bad
argument type. Expected collection index (string or integer)."

Thanks.
 
S

Steve Rindsberg

Hey, that's the spirit ... jump in there and have at it.
See the comment below:
I pasted some snippets of code together and got this:

======
Sub ExportAllSlideText()
Dim oSlide As Slide
Dim oShape As Shape

' Interate thru each slide in the presentation
For Each oSlide In ActivePresentation.Slides

' Interate thru each shape in the current slide
For Each oShape In oSlide.Shapes

' Check if the current shape has a text frame
If oShape.HasTextFrame Then

' Check if the text frame has text in it.
If oShape.TextFrame.HasText Then

Change this:
With ActivePresentation.Slides(oSlide). _
NotesPage.Shapes(2).TextFrame.TextRange
Text = .Text & vbCr & oShape.TextFrame.TextRange.Text
End With

With oSlide.NotesPage.Shapes(2).TextFrame.TextRange
Text = .Text & vbCr & oShape.TextFrame.TextRange.Text
End With
 
P

pptman

It seems that there's no error anymore...but it doesn't do what I want?
Weird. I run the macro, and it seems like it finishes, but there's no
text the the notes section. I save, close, and open the Powerpoint
presentation, and there's still no notes!

Any ideas? =/
 
P

pptman

I did:

With oSlide.NotesPage.Shapes(2).TextFrame.TextRange
Text = Text & vbCr & oShape.TextFrame.TextRange.Text
MsgBox Text
End With

Just to see what "Text" contained...it seems as if the text from the
slides is being collected, but it's not being saved/placed into the
notes section of each slide.

I made a test Powerpoint file of 5 slides with slide text on each
slide. The MsgBox showed that "Text" collected each line of the slide
text and kept adding on to it and by the end, "Text" contained words
from ALL 5 slides, rather than saving all the text from each slide to
its respective notes section and then clearing the variable.
 
P

pptman

OK, I look like a crazy person, posting 4, 5 times in succession...but
I finally figured it out. If you can optimize this code a little for
me, I'd greatly appreciate it!

======
Sub ExportAllSlideText()
Dim oSlide As Slide
Dim oShape As Shape

' Interate thru each slide in the presentation
For Each oSlide In ActivePresentation.Slides

' Interate thru each shape in the current slide
For Each oShape In oSlide.Shapes

' Check if the current shape has a text frame
If oShape.HasTextFrame Then

' Check if the text frame has text in it.
If oShape.TextFrame.HasText Then
' This is to keep adding text from each Shape to Text and then insert
it into the Notes
Text = Text & vbCr & oShape.TextFrame.TextRange.Text
oSlide.NotesPage.Shapes(2).TextFrame.TextRange.Text = Text

' Check to see what's in Text
' MsgBox Text

End If
End If
Next oShape

' Clear Text & Next slide
Text = ""
Next oSlide

'End routine
End Sub
======

Hope it helps somebody out there in the world! =)
 
S

Steve Rindsberg


Aw nuts. Bad eyes, small screen on this laptop ...
Sorry ... I missed this:

With oSlide.NotesPage.Shapes(2).TextFrame.TextRange
.Text = .Text & vbCr & oShape.TextFrame.TextRange.Text
MsgBox .Text
End With

Put a period in front of the word "Text" in three places.
 

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