Results 1 to 4 of 4
  1. #1
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Aligning Tab Stops (Word 2000)

    I am able to find Custom Tabs at a specific Position and move them or change the type of Tab Stop (from Left to Right aligned for example) using the TabStops object. However, having located a specific TabStop I want to be able to read the text at that position (to see if it is a number, for example). Any ideas?? Andy.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Aligning Tab Stops (Word 2000)

    A tabstop is a property of a paragraph. One paragraph can contain many lines, with a tab character that pushes text to the tab stop in several of these lines. There can be text at the tab stop position in other lines of the paragraph too, without a tab character before it. So "the text at that position" is not clearly defined.

  3. #3
    5 Star Lounger
    Join Date
    Mar 2001
    Posts
    989
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Aligning Tab Stops (Word 2000)

    Thank you, that makes sense. So assuming a TabStop within a paragraph, how can I navigate to the relevant text within each 'line'? Andy.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Aligning Tab Stops (Word 2000)

    I can think of two ways, but the following are just rough versions, I haven't worked out the details, so you will need to do the fine-tuning yourself:

    1. Use Selection.Find to locate the tabstop:

    Selection.Find.Execute "^t"
    Selection.Next(Unit:=wdWord).Select
    MsgBox Selection

    2. Analyze the text character by character:

    Dim str As String, lngPos1 As Long, lngPos2 As Long
    str = Selection.Paragraphs(1).Range.Text
    lngPos1 = InStr(str, Chr(9))
    lngPos2 = InStr(lngPos1 + 1, str, " ")
    str = Mid(str, lngPos1 + 1, lngPos2 - lngPos1 - 1)
    MsgBox str

    Other Loungers may have better suggestions...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •