|
本帖最后由 duquancai 于 2016-11-13 23:24 编辑
- Private Sub CommandButton1_Click()
- Dim rng As Range, d As Object, Act As Document, k, i%, Ds As Range
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- Set Act = ActiveDocument
- On Error Resume Next
- For i = 1 To Act.ActiveWindow.ActivePane.Pages.Count
- Selection.GoTo 1, 1, i
- Set rng = Selection.Bookmarks("\page").Range
- If rng.InlineShapes.Count + rng.ShapeRange.Count > 0 Then
- d.Add i, "": GoTo 100
- Else
- Set Ds = rng.Duplicate
- With Ds.Find
- .Text = "[!^13]{1,}"
- .MatchWildcards = True
- Do While .Execute
- If Not .Parent.InRange(rng) Then Exit Do
- If .Parent.HighlightColorIndex <> wdAuto Or .Parent.Font.ColorIndex <> wdAuto Then
- d.Add i, "": Exit Do
- End If
- Loop
- End With
- End If
- 100 Next
- For Each k In d.keys
- stxt = stxt & k & ","
- Next
- Open Act.Path & "\页码.txt" For Output As #1
- Print #1, "图形/图片/彩色字/高亮字所在页码为:" & stxt
- Close #1
- Application.ScreenUpdating = True
- MsgBox "页码已经输出到同文件夹下的TXT文本!"
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|