Home |
Search |
Today's Posts |
#1
|
|||
|
|||
TAB key appends new row to table - can this be turned off
1. When you're in the last cell of a table, the TAB key appends a new
row to the table. Sometimes I want to turn off this feature. Is there a way to do this? I have Word 2000. 2. IIRC some other version of Word used to offer the option. Am I nuts? 3. One reason I wanted this is to help with some macros that processed each cell in a table. I wanted them to stop on the last cell, but they wouldn't. Is there a way to instruct Word, using a macro, to move to the next cell but NOT to create a new row if it's already in the last cell? (rightmost cell of bottom row). I know that there are VBA functions that tell you what row and column you are in, and the table dimensions. Unfortunately they don't always work correctly, especially if any cells in the table have been merged or split, or tables of different sizes have been joined. 4. There's probably another way to cycle through table cells using VBA. Any pointers? (I had another reason for this request, other than writing a macro, but I'm having a premature senior moment and can't remember it.) -- Steven Marzuola "You can fix it on the drawing board with an eraser or you can fix it on the site with a sledgehammer." -- Frank Lloyd Wright |
#2
|
|||
|
|||
Hi Steven,
1. No, you can't turn it off, other than using a key binding to disable the Tab key. Read on, though -- you don't need to turn it off. 2. My memory only goes back to Word for Windows 2.0 :-) and I don't recall such an option. 3 & 4. Yes, there's another way to access all the cells in a table without triggering the new row. It depends on using the .Next property of the Cell object. It copes perfectly well with merged/split cells. Here's a sample macro: 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 I've set the followup for this thread to the microsoft.public.word.vba.beginners newsgroup. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org On Wed, 08 Jun 2005 11:01:43 -0500, "Steven Marzuola (remove wax and invalid for reply)" wrote: 1. When you're in the last cell of a table, the TAB key appends a new row to the table. Sometimes I want to turn off this feature. Is there a way to do this? I have Word 2000. 2. IIRC some other version of Word used to offer the option. Am I nuts? 3. One reason I wanted this is to help with some macros that processed each cell in a table. I wanted them to stop on the last cell, but they wouldn't. Is there a way to instruct Word, using a macro, to move to the next cell but NOT to create a new row if it's already in the last cell? (rightmost cell of bottom row). I know that there are VBA functions that tell you what row and column you are in, and the table dimensions. Unfortunately they don't always work correctly, especially if any cells in the table have been merged or split, or tables of different sizes have been joined. 4. There's probably another way to cycle through table cells using VBA. Any pointers? (I had another reason for this request, other than writing a macro, but I'm having a premature senior moment and can't remember it.) |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table headers/footers and layout | Page Layout | |||
How to Avoid Word 2003 Table Style Problems | Tables | |||
Table AutoFormats vs. Table Styles confusion | Tables | |||
Row height problem with table in table | Tables | |||
table caption numbering | Tables |