我已将气球评论更改为脚注,并使用了作者的名字。我需要作者的姓名以粗体显示,但我无法让我的代码阅读脚注。我的问题在于设置:oFootnote
我尝试调用 strAuthor 并将其设为粗体,但因为它不再是评论。作者我无法再设置它,因为它现在在脚注中。我在互联网上尝试了很多例子,但我无法让它们工作:StackOverflow 的 How do i make a string bold; 也使用 VBA 将粗体文本插入 Word
Set oFootnote = oDoc.Footnotes.Add(Range:=Selection.Range, Text:="Some text")
我是练习生,请不要太苛刻地评价我
'Convert comments to footnotes with Author name in bold
Dim i As Long
Dim oDoc As Document
dim oComment as Comments
Dim oFootnote As Footnotes
'Document is the ActiveDocument
Set oDoc = Application.ActiveDocument
'the author's name needs to be bold (the last two words in each footnote)
Set oFootnote = oDoc.Footnotes
With oFootnote
Selection.Range.Words.Last.Words (2)
'Make the last two words bold'
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Font.bold = True
End With
End With
Selection.Find.Execute
'Set oFootnote = Nothing
Next
我试过了
Set oFootnote = oDoc.Footnotes Range:=Selection.Words.Last.Words(2)
但它不喜欢“Range:= onwards”所以我做了
Selection.Range.Words.Last.Words (2) invalid use of a property