Note that you don't have to select the table at all. You can call the Sort
method directly from the Range object associated with the table.
Dim r As Range
Set r = ActiveDocument.Tables(2).Range
'(etc.)
--
Stefan Blom
Microsoft Word MVP
---------------------------------------------
"Johnnyboy5" wrote in message
Thanks that worked - see my other post to sort that table by column
2 - nearly there
Many more thanks
Johnnyboy
Hi
thanks - sorted it out - might have been a bit basic but it works
Regards
Sub tableresort()
' this is too resort the table to John's domain layout
' Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:=""
End If
' go to the first row second column in table two
ActiveDocument.Tables(2).Cell(Row:=1, Column:=2).Range.Select
Selection.Collapse
Selection.SortAscending
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, Noreset:=True, Password:=""
End If
End Sub