0
我有以下用於Microsoft Powerpoint 365的宏,用於將筆記導出到單獨的.txt
文件中。問題是它排除了筆記中的註釋中的子彈點。我該如何解決這個問題?導出帶格式的筆記
Sub ExportNotesText()
Dim oSlides As Slides
Dim oSl As Slide
Dim oSh As Shape
Dim strNotesText 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?", ActivePresentation.Path + "\notes.txt")
' 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
strNotesText = strNotesText & "Slide: " & CStr(oSl.SlideIndex) & vbCrLf _
& oSh.TextFrame.TextRange.Text & vbCrLf & 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
Close #intFileNum
' show what we've done
' lngReturn = Shell("NOTEPAD.EXE " & strFileName, vbNormalFocus)
End Sub
您應該使用實際的對話框而不是'InputBox'來獲取文件名。另外,'strNotesText'包含的東西看起來像是圓點嗎?您的問題可能/應該縮小到「獲取筆記文本」部分。 –
它通常是「已完成的事情」,爲您從其他源複製的代碼提供歸因。就我個人而言,我不會太胡思亂想,因爲它是我複製的代碼,NBD。其他人可能會被冒犯。信譽(或責備?)在哪裏應該是一個好習慣。 IAC,TXT文件通常不會顯示子彈;你是否想用其他角色代表他們,也許是星號? –
@SteveRindsberg我道歉,史蒂夫,我通常會,但是,我有這個宏設置了一段時間,不記得它的來源 – Dan