|
楼主 |
发表于 2017-7-1 20:42
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Public nc
Sub 隐显答案()
nc = nc + 1
cs = nc Mod 2 + 1
cl1 = Choose(cs, -603914241, -587137025)
cl2 = Choose(cs, -587137025, -603914241)
With ActiveDocument.Content
With .Find
.Format = True
.Forward = True
.MatchByte = True
.Wrap = wdFindContinue
With .Font
.NameFarEast = "楷体"
.Size = 10.5
.Bold = True
.Color = cl1
.Underline = Choose(cs, wdUnderlineSingle, wdUnderlineWavy)
End With
With .Replacement.Font
.NameFarEast = "楷体"
.Size = 10.5
.Bold = True
.Color = cl2
.Underline = Choose(cs, wdUnderlineWavy, wdUnderlineSingle)
End With
.Execute Replace:=wdReplaceAll
End With
Call 隐显答案2
Call 隐显答案3
End With
End Sub
Sub 隐显答案2()
cs = nc Mod 2 + 1
cl1 = Choose(cs, -603914241, -587137025)
cl2 = Choose(cs, -587137025, -603914241)
With ActiveDocument.Content
With .Find
.Format = True
.Forward = True
.MatchByte = True
.Wrap = wdFindContinue
With .Font
.Size = 10.5
.Color = cl1
.Underline = wdUnderlineSingle
End With
With .Replacement.Font
.Size = 10.5
.Color = cl2
.Underline = wdUnderlineSingle
End With
.Execute Replace:=wdReplaceAll
End With
End With
End Sub
Sub 隐显答案3()
cs = nc Mod 2 + 1
cl1 = Choose(cs, -603914241, -587137025)
cl2 = Choose(cs, -587137025, -603914241)
Call 第一步
With ActiveDocument.Content
With .Find
.Format = True
.Forward = True
.MatchByte = True
.Wrap = wdFindContinue
With .Replacement.Font
.Color = Choose(cs, -603914241, -587137025)
.Name = "方正姚体" '"Arial Black"
.Bold = True
End With
.Execute "^s", , , , , , , , , "", 2
.Execute "([\((]@)([^32]@)([A-Z]@)([\))]@)", , , 1, , , , , , "\1\3\4", 2
.Execute "([\((]@)([A-Z]@)([^32]@)([\))]@)", , , 1, , , , , , "\1\2\4", 2
.Execute "[\((]@[A-Z]@[\))]@", , , 1, , , , , , "^&", 2
End With
Call 显示括号
End With
End Sub
Sub 显示括号()
ss = IIf(nc = 6, 1, nc Mod 6 + 1)
With ActiveDocument.Content.Find
.Format = True
.Forward = True
.MatchByte = True
.Wrap = wdFindContinue
With .Replacement.Font
.ColorIndex = Choose(ss, 1, 2, 3, 4, 5, 6, 7) '1,黑色;2,蓝色;3,天兰;4,绿色;5,红色;6,红色;7,黄色;8,白色
.Name = "方正姚体"
.Bold = False
End With
.Execute "[\((\))]@", , , 1, , , , , , "^&", 2
End With
End Sub
Sub 第一步()
With ActiveDocument.Content
.Find.Execute "^s", , , 1, , , , , , "", 2
End With
ActiveDocument.Content.Find.Execute "^w", , , , , , , , , " ", 2
End Sub |
|