我有一个包含大约50张幻灯片的PowerPoint。每张幻灯片可能有一个或多个由reviwer提供的评论(使用insert->评论菜单完成)。
我正在尝试使用此VBA代码以编程方式将注释导出到文本文件中:
Sub ConvertComments()
''# Converts new-style comments to old
Dim oSl As Slide
Dim oSlides As Slides
Dim oCom As Comment
Set oSlides = ActivePresentation.Slides
For Each oSl In oSlides
For Each oCom In oSl.Comments
''# write the text to file : (oCom.Text)
WriteToATextFile oCom.Author, <what needs to come here>, oCom.Text
Next oCom
Next oSl
End Sub
在上面的代码中,我需要提供注释上下文以及写入文本文件(幻灯片中的哪一行被选中并评论)
问题:我可以使用任何属性来获取此信息吗?
答案 0 :(得分:4)
像这样:
Sub ConvertComments()
''# Converts new-style comments to old
Dim oSl As Slide
Dim oSlides As Slides
Dim oCom As Comment
Dim oShape As Shape
Open "filename.txt" For Output As 1
Set oSlides = ActivePresentation.Slides
Dim myContext As String
For Each oSl In oSlides
For Each oCom In oSl.Comments
myContext = ""
For ShapeIndex = oCom.Parent.Shapes.Count To 1 Step -1
myContext = myContext & oCom.Parent.Shapes(ShapeIndex).AlternativeText & " "
Next
Write #1, oCom.Author & ";" & myContext & ";" & oCom.Text
Next oCom
Next oSl
Close 1
End Sub
主要部分是通过注释的所有形状的循环。