View Single Post
  #3   Report Post  
Posted to microsoft.public.word.tables
Steven M (remove wax and invalid to reply) Steven M (remove wax and invalid to reply) is offline
external usenet poster
 
Posts: 5
Default Turn off automatic row addition?

Thanks. I had forgotten, but I posted the same question then, too!

Steven


Je Thu, 19 Jul 2007 12:16:26 +0200, "Stefan Blom"
skribis:

Try this macro (posted by Jay Freedman two years ago in the "TAB key appends
new row to table - can this be turned off" thread at
http://groups.google.se/group/micros...b62108f585b/):

Sub TableDemo()
Dim oRg As Range
Dim oCell As Cell


' make sure there is a table
' (prevent an error message)
If ActiveDocument.Tables.Count = 0 Then
MsgBox "No tables!"
Exit Sub
End If


' start at top left
Set oCell = ActiveDocument.Tables(1).Cell(1, 1)


' since we know there is a table, it must have
' at least a Cell(1,1), so this loop will
' execute at least once
Do While Not oCell Is Nothing
' get its range
Set oRg = oCell.Range


' exclude end-of-cell mark from oRg
oRg.MoveEnd unit:=wdCharacter, Count:=-1


' make it bold
oRg.Bold = True


' display it
MsgBox oRg.Text


' go to the next cell
Set oCell = oCell.Next


' if that was the last one and there is
' no next cell, then oCell is now Nothing
' so loop will terminate
Loop
End Sub



--
Steven M - lid
(remove wax and invalid to reply)

"It's a damned fool mind that can only think of one way to
spell a word." -- attributed to Dizzy Dean