海蒂有15个文件,每个文件主要由一张长桌组成。

她需要创建一个宏来逐行搜索,并以某种方式突出显示(通过阴影,加粗,更改字体等)任何在行中任何地方都没有括号的行。另外,她还可以突出显示确实包含括号字符的行-她只需要能够区分行和不行。

可以使用很多方法来使用这种宏,但是搜索开括号或闭括号的方法相对容易。以下示例将逐行进行搜索,如果找到任何一个字符,它将通过使背景变黄来突出显示该行。

Sub HilightRows()

Dim TargetText1 As String     Dim TargetText As String     Dim oRow As Row     Dim iCol As Integer

'initialize the target characters to find     TargetText = "("

TargetText1 = ")"



'Make sure we're in a table     If Selection.Information(wdWithInTable) Then         'Clear all the old shading         Selection.Tables(1).Shading.BackgroundPatternColor = wdColorWhite         'do all the rows         For Each oRow In Selection.Tables(1).Rows             If InStr(oRow.Range.Text, TargetText) > 0 Then _               oRow.Shading.BackgroundPatternColor = wdColorYellow             If InStr(oRow.Range.Text, TargetText1) > 0 Then _               oRow.Shading.BackgroundPatternColor = wdColorYellow         Next oRow     End If End Sub

注意:

如果您想知道如何使用此页面(或_WordTips_网站上的任何其他页面)中描述的宏,我准备了一个包含有用信息的特殊页面。

_WordTips_是您进行经济有效的Microsoft Word培训的来源。

(Microsoft Word是世界上最流行的文字处理软件。)本技巧(568)适用于Microsoft Word 97、2000、2002和2003。您可以为Word(Word 2007)的功能区界面找到此技巧的版本。和更高版本)在这里: