Reply
 
Thread Tools Display Modes
  #1   Report Post  
Steven Marzuola (remove wax and invalid for reply)
 
Posts: n/a
Default 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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Table headers/footers and layout Keith Page Layout 1 April 8th 05 07:37 PM
How to Avoid Word 2003 Table Style Problems Judy Haynes Tables 0 March 23rd 05 06:41 PM
Table AutoFormats vs. Table Styles confusion Tony Jollans Tables 5 March 6th 05 07:18 PM
Row height problem with table in table Stephanie T. Tables 0 November 23rd 04 03:35 PM
table caption numbering scottkinsey Tables 1 November 11th 04 11:47 AM


All times are GMT +1. The time now is 10:20 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"