|
楼主 |
发表于 2014-4-24 09:58
|
显示全部楼层
再次简化,去掉Selection对象,方便移植。- Sub 嵌套域2()
- Dim aField As Field, bField As Field
- Dim aRange As Range
- With ActiveDocument
- Set aRange = .Range(.Content.End - 1, .Content.End - 1)
- Set aField = aRange.Fields.Add(aRange, wdFieldEmpty, "", False)
- Set aRange = .Range(aField.Code.Start, aField.Code.End)
- Set bField = aRange.Fields.Add(aRange, wdFieldEmpty, "NumPages", False)
- Set aRange = aField.Code
- .Range(aRange.Start, aRange.Start).Text = "="
- .Range(aRange.End, aRange.End).Text = "-1"
- aField.Update
- End With
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|