Supercharge your PowerPoint productivity with
|
PPTools |
ProblemYou want to get a list of just the comments in a PowerPoint file. Solution
Sub ExportComments()
Dim oSl As Slide
Dim oSlides As Slides
Dim oCom As Comment
Dim sText As String
Dim sFilename As String
Set oSlides = ActivePresentation.Slides
For Each oSl In oSlides
sText = sText & "Slide: " & oSl.SlideIndex & vbCrLf
sText = sText & "======================================" & vbCrLf
For Each oCom In oSl.Comments
sText = sText & oCom.Author & vbCrLf
sText = sText & oCom.DateTime & vbCrLf
sText = sText & oCom.Text & vbCrLf
sText = sText & "--------------" & vbCrLf
Next oCom
Next oSl
sFilename = InputBox("Full path to output file:", "Output file")
If Len(sFilename) > 0 Then
WriteStringToFile sFilename, sText
SendFileToNotePad sFilename
End If
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
' this writes the text out to a file
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
' This opens the file in notepad
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code. Español Deutsch Français Português Italiano Nederlands Greek Japanese Korean Chinese |
Supercharge your PPT Productivity with PPTools
|
content authoring & site maintenance by |
Export comments to a text file (PowerPoint 2002 and later)
http://www.pptfaq.com/FAQ00900.htm
Last update 02 October, 2007