本文介绍了如何获取一个网页的使用Word自动化的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你如何找到n页的在Microsoft Word中使用办公自动化的范围内?目前似乎没有getPageRange(n)函数,目前尚不清楚他们是如何划分。

How do you find the range of page n in Microsoft Word using office automation? There appears to be no getPageRange(n) function and it is unclear how they are divided.

推荐答案

这是你如何从VBA做到这一点,应该是相当琐碎转换为Matlab的COM调用。

This is how you do it from VBA, should be fairly trivial to convert to Matlab COM calls.

Public Sub DemoPerPageText()

    Dim i As Integer
    Dim totalPages As Integer
    Dim bmRange As Range

    totalPages = Selection.Information(wdNumberOfPagesInDocument)

    For i = 1 To totalPages
      Set bmRange = ActiveDocument.Bookmarks("\Page").Range
      Debug.Print CStr(i) & " : " & bmRange.Text & vbCrLf
    Next i

End Sub

这篇关于如何获取一个网页的使用Word自动化的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 08:06