Oh, the cursor is the Selection object. It has a Start and End property in the form of a Long Integer. The beginning of the document is 0, and it counts every character (including spaces) from there. The Selection object can of course be more than one character long. When it is just one character, it can be said to have selected nothing...sort of. So when the cursor (the Selection) is "empty". the range Start and End are equivalent.
Msgbox Selection.Range.Start
will display the current location of the START of the selection.
If you want to make sure that the Selection is, in fact, collapsed to a point, look up Collapse in Help. You can collapse in either direction (forwards or backwards).
However, this is likely not the real solution to your problem. Are you absolutely sure that you have tried everything to make the table not break over a page? Is the table so big that HAS TO?
Oh,since you are thinking about playing with locations, you will most likely need to also look up "predefined bookmarks" in Help. For example, you can determine the
current Start and End locations (as numbers, integers) of current page, using the "\page" bookmark. For example:
Code:
Sub CheckTable()
If Selection.Information(wdWithInTable) = True Then
If Selection.Tables(1).Range.End > _
ActiveDocument.Bookmarks("\page").Range.End Then
MsgBox "This table extends beyond this page."
Else
MsgBox "This table does NOT extend beyond this page."
End If
Else
MsgBox "Selection is not in a table."
Exit Sub
End If
End Sub
But this is only useful if the Selection is in fact in a table, a rather tedious exercise. yes, you could loop through all the tables in the document, and make the above a Boolean function, and if True (it DOES break across the page), put in a page break - however, you should be able to make a setting that disallows that, without code. Something is not quite right here.
Or is the table just too darn big?
Gerry