Reputation: 415
What code to write for Word Macro to get the coordinates of left, top corner of a page of a word document?
The Left and Top properties of the Page object are always zero, so I cannot use them.
I need screen coordinates of the left, top corner of a page in a word document.
How to get that?
Upvotes: 1
Views: 3305
Reputation: 78933
This doesn't work for the page, but it'll give you the coordinates of the top and left of the active window. Is that of any help? (Or does it get you any closer?)
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
Source: http://msdn.microsoft.com/en-us/library/office/aa172241%28v=office.11%29.aspx
NB: Looks like working with pages is out of the question with the Word object model.
Upvotes: 2