Re: Tab Position by Jonathan
Jonathan
Wed Jan 12 04:34:06 CST 2005
Hi Robert,
Where the tabs move the cursor to is defined by the TabStops collection of
the Paragraph or ParagraphFormat object. The TabStops collection is a
collection of TabStop objects. Each Tabstop object has several properties,
including a Position property, which indicates the position of the tabstop
in points relative to the left margin (72 points = 1 inch).
Therefore, the following line of code will display the position in
centimeters of the first tab of the currently selected paragraph
MsgBox "First tabstop is at " & _
PointstoCentimeters(Selection.Paragraphs(1).TabStops(1).Position) & "
cm"
If you know where you think tab 1 ought to be, you can compare its position
with that of the actual first tab of a paragraph, and so work out which
column the text after the first tab is appearing in.
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
"Robert" <anonymous@discussions.microsoft.com> wrote in message
news:012601c4f81b$bf1e83b0$a401280a@phx.gbl...
> Thanks Jonathan for the suggestion, but that does not seem
> to work and this is getting very frustrating trying to
> figure out.
>
> When I start at the very end of each line preceding each
> of the (2)examples below, there is (1) chr(13) for a
> paragraph mark and (2) chr(9) for a tab mark. But on line
> one, you only go to the beginning of the line and with
> line 2 you go over to the Tab2 position. I am guessing
> that the tab must have some kind of properties that tells
> Word to go over to the tab2 position, but darn if I know
> what it is.
>
> If anyone could offer any suggestions, it would be greatly
> appreciated!
>
> Tab 1 Tab 2
>>> Line 1 Some Text Some other text
>>> Line 2 Yet more text
>
>
>
>>-----Original Message-----
>>Hi Robert,
>>
>>You can check to see whether there are two consecutive
> Tab characters in
>>that paragraph. If there are, then there is no text at
> Tab 1.
>>
>>--
>>Regards
>>Jonathan West - Word MVP
>>www.intelligentdocuments.co.uk
>>Please reply to the newsgroup
>>
>>"Robert" <anonymous@discussions.microsoft.com> wrote in
> message
>>news:01a901c4f437$fdb62d90$a501280a@phx.gbl...
>>> Hi,
>>>
>>> I am new to VBA in Word. Would anyone be able to answer
>>> this:
>>>
>>> If I have two tabs and I am at the position starting at
>>> the second tab, how can I determine in VBA if there is
>>> anything at the first tab on the next line. For example:
>>>
>>> Tab 1 Tab 2
>>> Line 1 Some Text Some other text
>>> Line 2 Yet more text
>>>
>>> If there is a paragraph mark at the end of "Some other
>>> text" on Line 1, when I return to the start of the next
>>> line, how can I determine if there is anything at Tab 1
>>> for the second line?
>>>
>>> I hope I am explaining this clear enough! Any help would
>>> be appreciated.
>>>
>>> Thanks.
>>>
>>>
>>>
>>>
>>
>>.
>>