Select text in macro

G

Guest

Helo

Is it possible to select a column in a table when recording a macro without
scripting?
I can't seem to find a way using menu/menubars...

Thank you in advance.

Lena
 
G

Greg Maxey

No it isn't possible. You can write code to select a column provided
the table is uniform (i.e, no split or joined cells).

For example:

Sub Test()
Dim pMyPick As String
pMyPick = InputBox("Which column do you want to select?", "Column")
If pMyPick > ActiveDocument.Tables(1).Columns.Count Then
MsgBox "There are not that many columns in this table."
Exit Sub
End If
If ActiveDocument.Tables(1).Uniform Then
ActiveDocument.Tables(1).Columns(pMyPick).Select
Else
MsgBox "Sorry :-(, You can't use VBA to select a column" _
& " in a table with mixed cell width!"
End If
End Sub

Where ActiveDocument.Tables(1) should be numbered to the table of
interest in the document or used Selection.Tables(1) and put the cursor
in the table before executing the macro.
 

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