Browsing through Column

K

Kushal

I am designing a macro in which i want to browse through a word document
containing 3 columns. How can I browse (move) around in the columns. Suppose
i want to go to last line of second column how can i do that. I don't want to
use column breaks at the end of column.
 
K

Kushal

Browsing means moving around. I want to design such a macro in which i can
move around a columns in a page.
 
D

Doug Robbins - Word MVP

That doesn't mean anything.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
H

Helmut Weber

Hi Kushal,

see:
http://word.mvps.org/FAQs/MacrosVBA/GetColNoOfSelection.htm

And have a pretty close look at this one:

Sub GotoEndofColumn(c As Long, p As Long)
' c = target column
' p = target page
' x = which column is the insertion point in
' y = which page in the insertion point on
Dim x As Long
Dim y As Long
With selection
.Collapse
.ExtendMode = False
.GoTo _
what:=wdGoToPage, _
which:=wdGoToAbsolute, _
Count:=p
x = Dialogs(wdDialogFormatColumns).ColumnNo
y = .Information(wdActiveEndPageNumber)
While x <> c + 1
.MoveRight
x = Dialogs(wdDialogFormatColumns).ColumnNo
y = .Information(wdActiveEndPageNumber)
If y <> p Then
.MoveLeft
Exit Sub
End If
' test for end of doc
' where moveright doesn't move the selection any further
If .End = ActiveDocument.Content.End - 1 Then
Exit Sub
End If
Wend
.MoveLeft
End With
End Sub

Sub test889()
GotoEndofColumn 2, 6
End Sub

It seems, there is no other way than
moving the selection around a lot.

All together it is nothing but a workaround,
until someone comes up with a perfect solution.

The code is in no way bullet proof,
but may give you an idea on how to tackle the problem.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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