J
Johnnyboy5
When I try to record a macro to select a whole table table to be re-
sort it, the macro recording wont let me select the table.
Word 2003
sort it, the macro recording wont let me select the table.
Word 2003
You should be able to do it using the menu: Table | Select | Table.
--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USAhttp://word.mvps.org
Thanks that worked - see my other post to sort that table by column
2 - nearly there
Many more thanks
Johnnyboy
Thanks that worked - see my other post to sort that table by column
2 - nearly there
Many more thanks
Johnnyboy
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
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
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
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
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.