View Single Post
 
Old 01-28-2018, 12:04 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

'Lines' are a vague concept in Word, especially in a document that is dynamically formatted and doubly so when there are columns.

I won't pretend to know what your document looks like and so I can't test your macro to see what it does in practice, but as you have discovered, moving down by lines ignores the presence of a second column of text and continues to the next page. You need to move right to move the next column.

I suppose you could test whether the page has changed each time you move down and then move back and move right to the start of the next column (that will also take you to the start of the next page) e.g. as follows but whether it will work in the context of your macro is hard to ascertain

Code:
'Move to the next part of the loop ##but wont do this when more than 1 column of text
        iPage = Selection.Information(wdActiveEndPageNumber)
        Selection.MoveDown Unit:=wdLine, Count:=1
        If Selection.Information(wdActiveEndPageNumber) > iPage Then
            Selection.MoveUp Unit:=wdLine, Count:=1
            Selection.EndKey Unit:=wdLine, Extend:=wdExtend
            Selection.MoveRight Unit:=wdCharacter
        End If
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote