Select a table macro for word 2003

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
 
J

Johnnyboy5

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
 
J

Johnnyboy5

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
 
S

Stefan Blom

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
 
J

Johnnyboy5

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

Thanks - will give it a go.

Johnnyboy
 
S

Stefan Blom

Please post back with your findings! :)

-- 
Stefan Blom
Microsoft Word MVP




---------------------------------------------
"Johnnyboy5" wrote in message

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

Thanks - will give it a go.

Johnnyboy
 

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