|
本帖最后由 jsyzzym 于 2014-5-6 15:07 编辑
想用VBA遍历WORD文档中的所有页面,取得每个页面的横、竖版式,找了一些资料,写了一段脚本,但只能显示光标所在页的版式,请求各位知道的朋友给予帮助,不胜感谢!
- Sub test()
- Dim nPageC As Integer
- Dim i As Integer
- nPageC = ActiveDocument.ActiveWindow.Panes(1).Pages.Count
- Debug.Print "共" & nPageC & "页"
- For i = 1 To nPageC
- With ActiveDocument.ActiveWindow.Panes(1)
- .Pages(i).Application.ActiveDocument.Activate
- Debug.Print .Pages(i).Application.Selection.Sections.PageSetup.Orientation
- End With
- Next
- End Sub
复制代码
谢谢楼下的帮助,已经解决了这个问题,顺附上遍历所有页面的代码,以供需要之人使用,再次感谢楼下的无私帮助:- Sub AllPage_InsCustomPageNum()
- Dim nPageC As Integer
- Dim i As Integer
- 'ActiveDocument.Content.Information (wdActiveEndAdjustedPageNumber)
- nPageC = ActiveDocument.ActiveWindow.Panes(1).Pages.Count
- For i = 1 To nPageC
- ActiveDocument.GoTo(wdGoToPage, wdGoToAbsolute, i).Select
- If Selection.PageSetup.Orientation = wdOrientLandscape Then Call InsCustomPageNum
- Next
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|