为Word Macro编写什么代码来获取Word文档页面左上角的坐标?
Page 对象的 Left 和 Top 属性始终为零,因此我无法使用它们。
我需要word文档中页面左上角的屏幕坐标。
如何得到它?
这不适用于页面,但它会为您提供活动窗口顶部和左侧的坐标。这有什么帮助吗?(或者它会让你更接近吗?
Public Sub WindowPosition()
Dim leftCoord As Long
Dim topCoord As Long
Dim w As Long
Dim h As Long
ActiveWindow.GetPoint leftCoord, topCoord, w, h, ActiveDocument
Debug.Print "Position:" & leftCoord & ":" & topCoord
End Sub
来源: http://msdn.microsoft.com/en-us/library/office/aa172241%28v=office.11%29.aspx
注意:看起来使用页面与 Word 对象模型是不可能的。