15

I have a Powerpoint Presentation (.pptx) file with 100 slides. I want to take all of the text from it and save it as a plain text file.

How can I do this? PowerPoint doesn't seem to let you save it as a .txt file directly, and I don't want to go through each slide to copy the text.

7 Answers7

12

If all of the text in the presentation is visible in the Outline view, you should be able to do File | Save As | Choose Outline (RTF).

Otherwise, you'll need a bit of VBA. There are a couple of examples on my PowerPoint FAQ site:

Export Text to a text file, extract text from PowerPoint (Mac or PC):

See: http://www.pptfaq.com/FAQ00274_Export_Text_to_a_text_file-_extract_text_from_PowerPoint_-Mac_or_PC-.htm


It saves the text from every shape on your notes pages to a file called NotesText.TXT in the same folder as the PowerPoint presentation itself.

Sub SaveNotesText()

Dim oPres As Presentation
Dim oSlides As Slides
Dim oSlide As Slide
Dim oShapes As Shapes
Dim oSh As Shape
Dim NotesText As String
Dim FileNum As Integer
Dim PathSep As String

#If Mac Then
    PathSep = ":"
#Else
    PathSep = "\"
#End If

Set oPres = ActivePresentation
Set oSlides = oPres.Slides

For Each oSlide In oSlides
    NotesText = NotesText & "Slide " & oSlide.SlideIndex & vbCrLf
    Set oShapes = oSlide.NotesPage.Shapes
    For Each oSh In oShapes
        If oSh.HasTextFrame Then
            If oSh.TextFrame.HasText Then
                NotesText = NotesText & oSh.TextFrame.TextRange.Text
            End If
        End If
    Next oSh
    NotesText = NotesText & vbCrLf
Next oSlide

FileNum = FreeFile
Open oPres.Path & PathSep & "NotesText.TXT" For Output As FileNum
Print #FileNum, NotesText
Close FileNum

End Sub

Here's a macro from Kris Lander that will export all the text on each slide in a presentation. Modified it a bit to make it work on Macs and to distinguish between title, subtitle, body and other text.

Sub ExportText()

  Dim oPres As Presentation
  Dim oSlides As Slides
  Dim oSld As Slide         'Slide Object
  Dim oShp As Shape         'Shape Object
  Dim iFile As Integer      'File handle for output
  iFile = FreeFile          'Get a free file number
  Dim PathSep As String
  Dim FileNum As Integer

  #If Mac Then
    PathSep = ":"
  #Else
    PathSep = "\"
  #End If

  Set oPres = ActivePresentation
  Set oSlides = oPres.Slides

  FileNum = FreeFile

  'Open output file
  ' NOTE:  errors here if file hasn't been saved
  Open oPres.Path & PathSep & "AllText.TXT" For Output As FileNum

  For Each oSld In oSlides    'Loop thru each slide
    For Each oShp In oSld.Shapes                'Loop thru each shape on slide

      'Check to see if shape has a text frame and text
      If oShp.HasTextFrame And oShp.TextFrame.HasText Then
        If oShp.Type = msoPlaceholder Then
            Select Case oShp.PlaceholderFormat.Type
                Case Is = ppPlaceholderTitle, ppPlaceholderCenterTitle
                    Print #iFile, "Title:" & vbTab & oShp.TextFrame.TextRange
                Case Is = ppPlaceholderBody
                    Print #iFile, "Body:" & vbTab & oShp.TextFrame.TextRange
                Case Is = ppPlaceholderSubtitle
                    Print #iFile, "SubTitle:" & vbTab & oShp.TextFrame.TextRange
                Case Else
                    Print #iFile, "Other Placeholder:" & vbTab & oShp.TextFrame.TextRange
            End Select
        Else
            Print #iFile, vbTab & oShp.TextFrame.TextRange
        End If  ' msoPlaceholder
      End If    ' Has text frame/Has text

    Next oShp
  Next oSld

  'Close output file
  Close #iFile

End Sub

And here we get a bit trickier and go after the text that's in groups. And in groups within groups. Look at this too closely and your head may start to hurt.

Sub ExportText()

  Dim oPres As Presentation
  Dim oSlides As Slides
  Dim oSld As Slide         'Slide Object
  Dim oShp As Shape         'Shape Object
  Dim iFile As Integer      'File handle for output
  iFile = FreeFile          'Get a free file number
  Dim PathSep As String
  Dim FileNum As Integer
  Dim sTempString As String

  #If Mac Then
    PathSep = ":"
  #Else
    PathSep = "\"
  #End If

  Set oPres = ActivePresentation
  Set oSlides = oPres.Slides

  FileNum = FreeFile

  'Open output file
  ' NOTE:  errors here if file hasn't been saved
  Open oPres.Path & PathSep & "AllText.TXT" For Output As FileNum

  For Each oSld In oSlides    'Loop thru each slide
    ' Include the slide number (the number that will appear in slide's
    ' page number placeholder; you could also use SlideIndex
    ' for the ordinal number of the slide in the file
    Print #iFile, "Slide:" & vbTab & cstr(oSld.SlideNumber)

    For Each oShp In oSld.Shapes                'Loop thru each shape on slide
      'Check to see if shape has a text frame and text
      If oShp.HasTextFrame And oShp.TextFrame.HasText Then
        If oShp.Type = msoPlaceholder Then
            Select Case oShp.PlaceholderFormat.Type
                Case Is = ppPlaceholderTitle, ppPlaceholderCenterTitle
                    Print #iFile, "Title:" & vbTab & oShp.TextFrame.TextRange
                Case Is = ppPlaceholderBody
                    Print #iFile, "Body:" & vbTab & oShp.TextFrame.TextRange
                Case Is = ppPlaceholderSubtitle
                    Print #iFile, "SubTitle:" & vbTab & oShp.TextFrame.TextRange
                Case Else
                    Print #iFile, "Other Placeholder:" & vbTab & oShp.TextFrame.TextRange
            End Select
        Else
            Print #iFile, vbTab & oShp.TextFrame.TextRange
        End If  ' msoPlaceholder
      Else  ' it doesn't have a textframe - it might be a group that contains text so:
        If oShp.Type = msoGroup Then
            sTempString = TextFromGroupShape(oShp)
            If Len(sTempString) > 0 Then
                Print #iFile, sTempString
            End If
        End If
      End If    ' Has text frame/Has text

    Next oShp
  Next oSld

  'Close output file
  Close #iFile

End Sub

Function TextFromGroupShape(oSh As Shape) As String
' Returns the text from the shapes in a group
' and recursively, text within shapes within groups within groups etc.

    Dim oGpSh As Shape
    Dim sTempText As String

    If oSh.Type = msoGroup Then
        For Each oGpSh In oSh.GroupItems
            With oGpSh
                If .Type = msoGroup Then
                    sTempText = sTempText & TextFromGroupShape(oGpSh)
                Else
                    If .HasTextFrame Then
                        If .TextFrame.HasText Then
                            sTempText = sTempText & "(Gp:) " & .TextFrame.TextRange.Text & vbCrLf
                        End If
                    End If
                End If
            End With
        Next
    End If

    TextFromGroupShape = sTempText

NormalExit:
    Exit Function

Errorhandler:
    Resume Next

End Function
kenorb
  • 26,615
Steve Rindsberg
  • 6,033
  • 1
  • 17
  • 20
7

This solution depends on your slidedeck being compatible with Google Slides, but you could use the "Download as Plain Text" option in Google Slides:

enter image description here

Granted you will lose any fancy formatting or layout stuff you've done, but you will get the text of the document.

RedRiderX
  • 463
  • 1
  • 5
  • 15
4

Export as PDF, Copy & Paste (CTRL+A, CTRL+C) from your PDF reader.

If you want a bit formatting, export the PDF via pdftotext with parameter -layout

Jaleks
  • 277
  • 2
  • 12
1

An update to Steve's answer, because my presentation had tables, and tables dont get exported with that code, the below has added code for just that;

Sub ExportText()
Dim oPres       As Presentation
Dim oSlides     As Slides
Dim oSld        As Slide        'Slide Object
Dim oShp        As Shape        'Shape Object
Dim iFile       As Integer        'File handle for output
iFile = FreeFile        'Get a free file number
Dim PathSep     As String
Dim FileNum     As Integer
Dim Cell        As Variant
Dim rowCounter  As Integer
Dim colCounter  As Integer
Dim out         As String

#If Mac Then
    PathSep = ":"
#Else
    PathSep = "\"
#End If

Set oPres = ActivePresentation
Set oSlides = oPres.Slides

FileNum = FreeFile

'Open output file
' NOTE:  errors here if file hasn't been saved
Open oPres.Path & PathSep & "AllText.TXT" For Output As FileNum

For Each oSld In oSlides        'Loop thru each slide
    For Each oShp In oSld.Shapes        'Loop thru each shape on slide

        'Check to see if shape has a text frame and text
        If oShp.HasTextFrame And oShp.TextFrame.HasText Then
            If oShp.Type = msoPlaceholder Then
                Select Case oShp.PlaceholderFormat.Type
                    Case Is = ppPlaceholderTitle, ppPlaceholderCenterTitle
                        Print #iFile, "Title:" & vbTab & oShp.TextFrame.TextRange
                    Case Is = ppPlaceholderBody
                        Print #iFile, "Body:" & vbTab & oShp.TextFrame.TextRange
                    Case Is = ppPlaceholderSubtitle
                        Print #iFile, "SubTitle:" & vbTab & oShp.TextFrame.TextRange
                    Case Else
                        Print #iFile, "Other Placeholder:" & vbTab & oShp.TextFrame.TextRange
                End Select
            Else
                Print #iFile, vbTab & oShp.TextFrame.TextRange
            End If        ' msoPlaceholder
        Else
            Print #iFile, "No text:" & vbTab & oShp.Type
            If oShp.HasTable = msoTrue Then

                If oShp.Table.Rows.Count > 0 Then

                    out = ""
                    For rowCounter = 1 To oShp.Table.Rows.Count
                        For colCounter = 1 To oShp.Table.Columns.Count

                            Set Cell = oShp.Table.Cell(rowCounter, colCounter).Shape
                            If Cell.HasTextFrame Then
                                If Cell.TextFrame.HasText Then
                                    out = out + vbTab + Cell.TextFrame.TextRange.Text
                                End If
                            End If

                        Next
                        out = out + vbNewLine
                    Next
                    Print #iFile, out
                    'for counter

                End If

            End If
        End If        ' Has text frame/Has text

    Next oShp
Next oSld

'Close output file
Close #iFile

End Sub

tomdemuyt
  • 422
1

Tested, and tested, and I do this all the time - no coding required. Exporting the slide text made easy. It's a double save (or print) process, because PPT always exports/prints/saves a page-at-a-time view no matter how you do it. So...here we go:

  1. Open your ppt file you want to get the text out of.
  2. Save As -> PDF (or print a PDF) - either way you get the same thing.
  3. Open the PDF in Adobe Acrobat Reader. At this point, when you Ctrl-A to select all, it only selects text on one slide at a time (Just like PPT) So...
  4. Click Print from inside Adobe Acrobat Reader and choose a PDF writer (MS Print to PDF or CutePDF Writer both work)
  5. Save a second PDF file
  6. Open the second PDF file, select all, and copy and paste to notepad, MS Word, or wherever you want it.
  7. There's your slide text. Whoomp.
1

I think the easiest method would be to upload the PPT document to Google Drive, open it in Google Slides, then File>Download>Plain Text.

You could then open it in Word or Google Docs.

0

I found the best answer was from a Microsoft guy, see here print one page with just the notes for each slide in your presentation.

If you want to consolidate the notes text from all of the slides into a single document, there's this macro:

Export the notes text of a presentation https://www.rdpslides.com/pptfaq/FAQ00481_Export_the_notes_text_of_a_presentation.htm

That'll give you a single text file with all of your notes text (there's also a version of the macro that gives you the slide title + notes text

Steve Rindsberg PowerPoint MVP

ChrisH
  • 1