View Single Post
 
Old 02-17-2024, 01:53 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,138
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

Bearing in mind that there are no 'pages' in a Word document, if your selected range is in a table. then the following is an example of code to move the selection before the table.
Code:
 Dim orng As Range
 Dim oTable As Table
    Set orng = Selection.Range
    If orng.Information(wdWithInTable) = True Then
        Set oTable = orng.Tables(1)
        orng.Start = oTable.Range.Start
        orng.Collapse 1
        orng.Select
        Selection.SplitTable
        Set orng = Selection.Range
        orng.Text = "The selection is before the table"
    Else
        orng.Text = "The selection is not in a table"
    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