Answers:
这是一个可以做你想要的宏。此宏假定您的问题在他们自己的段落中。如果它们可能散布在段落中,您可以使用while循环来逐个扩展选择字符,直到您点击大写字母,而不是仅扩展到整个段落。
Sub FormatQuestions()
'Finds everything that starts with a capital letter and ends with a question mark. Bolds it and puts it in all caps.
'Variable definitions
Dim intTotalChars As Integer
Dim intLoop As Integer
Dim strTestChar As String
Dim rngQuestionRange As Range
Dim intCountQuestionMarks As Integer
intTotalChars = ActiveDocument.Characters.Count
For intLoop = 1 To intTotalChars
strTestChar = ActiveDocument.Characters.Item(intLoop).Text
If strTestChar = "?" Then
intCountQuestionMarks = intCountQuestionMarks + 1
ActiveDocument.Characters.Item(intLoop).Select
Selection.Expand wdParagraph
Selection.Font.Bold = True
Selection.Font.AllCaps = True
End If
Next intLoop
End Sub
在此答案的先前版本中,我错误地注意到Word不允许您同时搜索段落标记和通配符。实际上确实如此,但你需要使用^ 13代替^ p。 (Microsoft的此页面列出了可以与通配符搜索一起使用的特殊字符: http://support.microsoft.com/kb/176776 )