This is actually a question about using a macro to export from
Powerpoint Notes to an Excel file. If there is a better forum for
this, please advise.
Meanwhile, I am having difficulty in removing the paragraph (enter)
breaks from the text output from Powerpoint Notes. If the text in the
Notes contained "enter" breaks, then the text is exported to the
spreadsheet, divided amongst different cells, where the "enter" breaks
occur. I need to remove these breaks somehow, so that I can have the
notes for each slide in a single cell.
thanks for any help you can provide! Code is below.
Sub ExportNotesText7()
Dim oSlides As Slides
Dim oSl As Slide
Dim oSh As Shape
Dim strNotesText As String
Dim strNotesText2 As String
Dim strFileName As String
Dim intFileNum As Integer
Dim lngReturn As Long
' Get a filename to store the collected text
strFileName = InputBox("Enter the full path and name of file to
extract notes text to", "Output file?")
' did user cancel?
If strFileName = "" Then
Exit Sub
End If
' is the path valid? crude but effective test: try to create the
file.
intFileNum = FreeFile()
On Error Resume Next
Open strFileName For Output As intFileNum
If Err.Number <> 0 Then ' we have a problem
MsgBox "Couldn't create the file: " & strFileName & vbCrLf _
& "Please try again."
Exit Sub
End If
Close #intFileNum ' temporarily
' Get the notes text
Set oSlides = ActivePresentation.Slides
For Each oSl In oSlides
For Each oSh In oSl.NotesPage.Shapes
If oSh.PlaceholderFormat.Type = ppPlaceholderBody Then
If oSh.HasTextFrame Then
If oSh.TextFrame.HasText Then
strNotesText2 = Replace(strNotesText2, Chr$(13),"")
strNotesText2 = Replace(strNotesText2, Chr(11), "")
strNotesText2 = Replace(strNotesText2, Chr(10),"")
strNotesText2 = strNotesText2 & "Slide: " &
CStr(oSl.SlideNumber) & vbTab & oSh.TextFrame.TextRange.Text & vbCrLf
Else: strNotesText2 = strNotesText2 & "Slide: " &
CStr(oSl.SlideNumber) & vbTab & " " & vbCrLf
End If
End If
End If
Next oSh
Next oSl
' now write the text to file
Open strFileName For Output As intFileNum
Print #intFileNum, strNotesText & strNotesText2
Close #intFileNum
' show what we've done
' lngReturn = Shell("EXCEL.EXE " & strFileName, vbNormalFocus)
End Sub