Tabstop Word2000 VBA

W

w.heijnen

I want to jump to a Tabstop in Word with VBA.
There are two Tabstops (Tab1 and Tab2) in the document.

Tab1 Tab2
Hello

The cursor is at the first character of the word Hello. Now I want to
jump to Tab1 or to Tab2.

Which code do I use in VBA?

Thanks
 
G

Graham Mayor

Selection.MoveLeft Unit:=wdWord, Count:=2 'for TAB1?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
M

macropod

Hi,

Did you want to type the tab characters, or are they already there? Graham's already told you how to handle the latter. To type it,
you could use something based on
Selection.TypeText Text:=vbTab

In either case, if there's any risk that your text string will pass the first tab stop, you'll need to test for that, perhaps using
something based on a comparison of:
Selection.Information(wdHorizontalPositionRelativeToTextBoundary)
against the tab position.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top