|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
楼主,Selection 只能用一次,但 Range 可以使用多次。请网络搜索“VBA帮助材料”来进一步学习吧!
请试用下面的代码:
- Sub a0227_CharPos()
- Dim r As Range, i&
- Set r = Selection.Range
- Selection.MoveStart 4
- Selection.MoveStart 5, 2
- Selection.Characters.First.Select
- i = ActiveDocument.Range(Start:=0, End:=Selection.End).Characters.Count
-
- Selection.HomeKey 6
- r.Select
-
- With ActiveDocument.Characters(i).Font
- .Size = 22
- .Bold = True
- .ColorIndex = wdRed
- .Underline = wdUnderlineDouble
- End With
-
- MsgBox "ActiveDocument.Characters(" & i & ")", 0 + 48
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|