Re: Move to tab location in document using paragraph index & tabst
- From: LostInMD <LostInMD@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 11:52:00 -0800
Hi Tony,
It does help. Once the tab at the custom tab stop is found, how do I go
about inserting my cursor at the tabstop so that I can begin manipulating it?
I played around with the code you wrote, and can see that it is finding the
tabs but can't seem to figure out how to get my cursor positioned at the tab
within the document. Thanks for all your help!
"Tony Jollans" wrote:
It seems to me that what you really want to do is work with Tabs. I haven't.
tested this fully and I'm sure it can be improved upon, but it will find
tabs at custom tab stops - does it help?
Selection.HomeKey Unit:=wdStory
For intCtrPara = 1 To ActiveDocument.Paragraphs.Count
Set objPara = ActiveDocument.Paragraphs(intCtrPara)
Dim objTempRange As Range
Set objTempRange = objPara.Range.Duplicate
With objTempRange.Find
.Text = vbTab
Do While .Execute
If objTempRange.Start > objPara.Range.End Then Exit Do
For Each objTabStop In objPara.TabStops
If objTabStop.Position >
objTempRange.Information(wdHorizontalPositionRelativeToPage) Then
' This is the tabstop that this tab character stops
at
If objTabStop.CustomTab Then
' it is a custom one - do your stuff here
MsgBox "tab at custom tab stop"
Exit For
End If
End If
Next
Loop
End With
Next
--
Enjoy,
Tony
"LostInMD" <LostInMD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DE90C9AF-411C-40F8-844E-DECC3238D3C8@xxxxxxxxxxxxxxxx
Hi Tony,
I'm newer to the the 'world of tabstops' and still am finding new things
out
about them. Would there be a way to look for a custom tabstop, and upon
finding it, determine if there is an associated tab, and if there is, to
move
the cursor to that tab that is associated with the tabstop --> for all
custom
tabstops w/in a document? Thanks again for all your help!
"Tony Jollans" wrote:
So you are interested in tabstops whether or not there is a tab in the
paragraph leading to them. I think you're out of luck. There is no way
(or
certainly no practical way) to position the cursor at an absolute
position
on the page which might be outside the text.
Can you say what you would have liked to do if it were possible?
--
Enjoy,
Tony
"LostInMD" <LostInMD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:98F47145-172D-4644-B48C-0046BD1C43B2@xxxxxxxxxxxxxxxx
Hi Tony,
The following code is how I retrieve the paragraph and tabstop index
from
the document:
m_Document.Application.Selection.HomeKey(Unit:=wdStory, Extend:=wdMove)
For intCtrPara = 1 To m_Document.Paragraphs.Count
objPara = m_Document.Paragraphs(intCtrPara)
intCtrTabStop = 0
For Each objTabStop In objPara.TabStops
intCtrTabStop = intCtrTabStop + 1
If objTabStop.CustomTab = True Then
'*****This is where I would put my cursor
at
this
'*****particular tabstop within this
particular paragraph.
'*****and do some manipulating of the
text/tab.
'*****I only want to manipulate custom tab
stops.
End If
Next
Next
Thanks for any suggestions you can offer!
"Tony Jollans" wrote:
What you want may be easy, or may be all but impossible. Hard to tell
without some more detail.
Do you mean the nth tabstop position whether or not there is a tab in
the
paragraph? This might be off the page.
Or do you mean the nth tab in the paragraph whatever tabstop it is at?
This
could be anywhere in the paragraph and not necessarily at a custom
tabstop.
Or do you mean the nth custom tab in the paragraph.
Or the nth tab at the start of a paragraph - and if so, only if it is
at
the
nth tabstop position, or always?
And do you only want Left tabs, or all types?
--
Enjoy,
Tony
"LostInMD" <LostInMD@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4612EDF4-5E69-4298-9762-7151A24FBFBA@xxxxxxxxxxxxxxxx
Hi All,
I need to move to a specific tabstop within a document. I know
which
paragraph it is in, and know the tabstop index for the tabstop
collection
for
the paragraph it is in. The question is: how do I place my cursor
at
the
actual tab in the document that is represented by this tabstop? Ex.
I
have
a tabstop in the 4th paragraph of a document. It is the 6th tabstop
in
the
paragraph. How do I physically move the cursor to the 6th tab in
the
paragraph? Thanks for ANY information you have to offer!
- Follow-Ups:
- Re: Move to tab location in document using paragraph index & tabst
- From: Tony Jollans
- Re: Move to tab location in document using paragraph index & tabst
- References:
- Re: Move to tab location in document using paragraph index & tabstop i
- From: Tony Jollans
- Re: Move to tab location in document using paragraph index & tabst
- From: LostInMD
- Re: Move to tab location in document using paragraph index & tabst
- From: Tony Jollans
- Re: Move to tab location in document using paragraph index & tabst
- From: LostInMD
- Re: Move to tab location in document using paragraph index & tabst
- From: Tony Jollans
- Re: Move to tab location in document using paragraph index & tabstop i
- Prev by Date: Re: Move to tab location in document using paragraph index & tabst
- Next by Date: Re: Move to tab location in document using paragraph index & tabst
- Previous by thread: Re: Move to tab location in document using paragraph index & tabst
- Next by thread: Re: Move to tab location in document using paragraph index & tabst
- Index(es):
Relevant Pages
|