mapping text in a line within a paragraph to tabstops RRS feed

  • Question

  •     Using MSWord 2010 I would like to use the tabstops object to manage characters on any given "line" of a document.  I want to determine what text is between two specific tabstops or perhaps from a different angle what tabstops surround a specific text.  Basically I want to get a point position for each charactor of a line so that I can locate the tabstops that are "surrounding" that character or group of characters.

      Does anyone know of a way using VBA to get a point position on a line for any given character in a document?  Ultimately I want to build a table based on the tabstops that adjusts the cell lengths based on where tabs are and the length of the text (nontab characters that may cross multiple tabspot(s) ) to go into each cell.

    Monday, January 24, 2011 9:16 PM


  • Hi William,

    Try something based on:

    Dim oRng As Range
    Set oRng = Selection.Range
    MsgBox oRng.Characters.First.Information(wdHorizontalPositionRelativeToTextBoundary)


    Dim oRng As Range
    Set oRng = Selection.Range
    MsgBox oRng.Characters.First.Information(wdHorizontalPositionRelativeToPage)

    Paul Edstein
    [MS MVP - Word]
    • Marked as answer by WilliamIV Tuesday, January 25, 2011 2:03 PM
    Monday, January 24, 2011 11:44 PM