View Single Post
 
Old 01-28-2012, 12:39 PM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Windows XP Office 2007
Competent Performer
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default How to select the first row of the current table

I am trying to write a macro to change some table settings. It's sorta working, but I could use a little help.

1. I can't figure out how to select the first row of the current table so I can set the font and flag it as a header row.

As I understand it, this code selects the second row in the first table of a document:
Code:
ActiveDocument.Tables(1).Rows(2).Select
Can I then use this code to select the first row in the table where the cursor is?
Code:
Selection.Tables(1).Rows(1).Select
I am also using this code to ensure that the cursor is actually in a table.
Code:
If Selection.Information(wdWithInTable) <> True Then
  MsgBox "The cursor is not in a table", , "MyTableSettings macro"
  Exit Sub
End If
Reply With Quote