PDA

View Full Version : word 2010 wdVerticalPositionRelativeToPage problem



tsvi999
03-28-2012, 05:44 AM
Hi,

I've used Selection.Information(wdVerticalPositionRelativeToPage) in a macro with word 2010, but got many wrong values (not always). It's defenitely a bug because when I've tried the same macro in word 2003 there was no problem.

Any ideas how I can get the wdVerticalPositionRelativeToPage in another way?

Thanks.

MacroShadow
03-28-2012, 11:22 AM
Just in case anybody's curious this is the code that the OP is using
Sub AAA()
'
' AAA Macro
'
'

For t = 1 To ActiveDocument.Endnotes.Count

Selection.GoTo What:=wdGoToEndnote, Which:=wdGoToAbsolute, Count:=t
Text$ = ActiveDocument.Endnotes(t).Range


Height = Selection.Information(wdVerticalPositionRelativeToPage)

If Height + InchesToPoints(0.1 / 2.54) <= HightPrevEnd + InchesToPoints(0.25 / 2.54) Then
myframe.Select
Selection.Collapse Direction:=wdCollapseEnd
Selection.MoveLeft Unit:=wdCharacter
Selection.TypeParagraph
Else
Set myframe = ActiveDocument.Frames.Add(Range:=Selection.Range)
Selection.Style = "Whatever"
myframe.VerticalPosition = Height + InchesToPoints(0.1 / 2.54)
End If

Selection.TypeText Text:=Text$

If Selection.Information(wdActiveEndPageNumber) Mod 2 = 1 Then Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft

HightPrevEnd = Selection.Information(wdVerticalPositionRelativeToPage)

Next

'For Each Endnote In ActiveDocument.Endnotes
' Endnote.Delete
'Next

End Sub

tsvi999
03-28-2012, 02:11 PM
Thanks,
But from where did you get the code?

MacroShadow
03-28-2012, 02:50 PM
It's a small world... Prog...