Find previous Table and select Table

N

Nde

Hi,

I am looking for a way to find the first table before the pointer and then
to select this Table in order to reformat the table properties.

Any ideas ?

Nde
 
H

Helmut Weber

Hi,
I am looking for a way to find the first table before the pointer and then
to select this Table in order to reformat the table properties.

pointer is not a terminus technicus (term) in Word,
though in some programming languages.

I am assuming you mean the insertion point.

Sub Testq()
Dim rTmp As Range
Set rTmp = Selection.Range
rTmp.start = ActiveDocument.Range.start
If rTmp.Tables.Count > 0 Then
rTmp.Tables(rTmp.Tables.Count).Select
Else
MsgBox "no table before IP"
End If
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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

Klaus Linke

Nde said:
Hi,

I am looking for a way to find the first table before the pointer and then
to select this Table in order to reformat the table properties.

Any ideas ?


Hi Nde,

Or, as in the interface, you could use the browser:

Dim oldTarget
oldTarget = Application.Browser.Target
Application.Browser.Target = wdBrowseTable
Application.Browser.Previous
Selection.Tables(1).Select
Application.Browser.Target = oldTarget

Regards,
Klaus
 

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