Results 1 to 15 of 15
  1. #1
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Tab key duplicates row in table (Word 2000 SR1)

    With the cursor inside a table, pressing the TAB key causes the row to be duplicated. Is there any way to disable this behavior?
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  2. #2
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Tallahassee, Florida, USA
    Posts
    901
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    As you describe, I don't know of this being a "normal" behavior. I've also checked various key combinations in the hopes that there may have been a stuck key, but was unfruitful.

    What is expected behavior is that tabbing in the last cell of a table would create a new blank row to appear under it (please forgive the English there, but I'm sure you get the idea). I don't think there's a way around that.
    Karen

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    One possible war round might be to assign the tab key to a macro- which works out where you are. If you're in the last cell of the table, it moves to the next position; otherwise normal action.

    The tab key is difficult to assign by the keyborad. By this, I mean I haven't been able to do it. But this code will set something up for you:
    <pre>CustomizationContext = ActiveDocument.AttachedTemplate
    KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyTab), _
    KeyCategory:=wdKeyCategoryMacro, Command:="InsertTab.Main"
    </pre>

    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Perhaps the terminology I chose was incorrect. I meant to say that hitting the Tab key created a new, blank row. It does duplicate the existing row to the extent of the number and placement of columns within the row; i.e., if the existing row had a 1 inch, 2 inch, and 3 inch column, the new row would also.

    The reason that this is a problem is that in this document, which consists of a large table, most of the document is protected for forms, with the exception of two rows, which by the use of section breaks inserted within the table, were left unprotected for data entry. This is done to allow the Check spelling as you type function to work within these fields.

    I would expect the user to tab from one form field to another, and when they do so in these fields, the result will be unexpected. I had not considered the idea of assigning a macro to the Tab key, but that certainly seems logical. I'll try it.
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  5. #5
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    I tried reassigning the Tab key, as you said. It didn't make any difference. <img src=/S/sad.gif border=0 alt=sad width=15 height=15>
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  6. #6
    BAM
    Guest

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Hi Gary,

    It's not the Tab key you're after - it's the NextCell Word command that you need to intercept. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    You could create a macro called NextCell that moves to the next cell of the table if the column number isn't the last column and the row number isn't the last row.

    Take a look at the Information Type property for help on these constants.

    Another option would be to leave the table in a protected state with form fields and use a macro to allow spell checking in a protected form:
    <A target="_blank" HREF=http://www.mvps.org/word/FAQs/MacrosVBA/SpellcheckProtectDoc.htm>http://www.mvps.org/word/FAQs/MacrosVBA/Sp...kProtectDoc.htm</A>
    ~~~~~~~~~~~~
    Cheers! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    That makes more sense. However, if we are intercepting the NextCell Word command, then what command do I use in the macro to move to the next cell? I'm not being deliberately obtuse, just confused...

    BTW, I had originally designed the form as being protected with form fields - my personal choice. After I was told that spell checking was necessary, I then designed the macro to spell check the text fields, and it was beautiful! However, the responsible party for the form insisted that it was imperative that Spell check as you type needed to be enabled. Talk about having to jump through hoops...
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  8. #8
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    > what command do I use in the macro to move to the next cell?

    Selection.MoveRight Unit:=wdCell

    If you are in the last column in a row, this will start a new row.

  9. #9
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    OK. The results of this macro are, if the cursor is in a one-column table row, or in the last column in a row, the TAB key has no effect. I'm guessing that this is by design, and I'm also guessing that this means that there is no way to get to the NextCell without using the NextCell command (makes sense).

    Perhaps I should have a MsgBox pop up and tell the users to use the mouse to select the next cell.
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    I think what is supposed to happen is that the user can tab through the table but not beyond the last existing cell. Try changing Selection.Information to Selection.Range.Information and see if that does it.

  11. #11
    BAM
    Guest

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Hi Gary,

    I wrote the macro in 97 and just had a chance to test it in 2000 and it functions the same in both versions. The <Tab> key will move to the next cell unless the insertion point is in the last cell of the table.

    You might want to double-check the code you used. Also note that you need to remove the "x" at the beginning of the macro name to intercept the built-in NextCell command. (I'm sure you caught this <img src=/S/grin.gif border=0 alt=grin width=15 height=15> - but more for others that may be following. I'll edit my original post to make this change.)
    ~~~~~~~~~~~~~~~
    Cheers! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  12. #12
    BAM
    Guest

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Hi Gary,

    I thought I replied to this yesterday - right after you posted. <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15> I wonder where it went? (Perhaps it was stolen by some stranger <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15> )

    Anyway, here is the macro you need:
    <pre>Sub NextCell()
    Dim eCol, eRow, mCol, mRow As String
    eCol = wdEndOfRangeColumnNumber
    eRow = wdEndOfRangeRowNumber
    mCol = wdMaximumNumberOfColumns
    mRow = wdMaximumNumberOfRows

    If Selection.Information(eCol) < Selection.Information(mCol) Or _
    Selection.Information(eRow) < Selection.Information(mRow) Then
    Selection.MoveRight Unit:=wdCell
    End If
    End Sub
    </pre>

    ~~~~~~~~~~~~~
    Cheers! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    *editied by Bam - corrected macro name*

  13. #13
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Yes, I agree. The TAB key works fine, unless the insertion point is in the last cell of the table, or in a one-column row. (I thought that was what I had said in my previous post, but I may not have been clear.). My problem is, what to do when the cell IS in the last cell of the table? Currently, with your macro, nothing will happen. This might confuse users, so I was going to use a MsgBox to tell them what was happening, and to use their mouse.

    Other than that, it works great. No more duplicated rows! The responsible party will be very happy. I copied and pasted your code (and yes, I did remember to remove the "x" <img src=/S/smile.gif border=0 alt=smile width=15 height=15>). Thanks!
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

  14. #14
    BAM
    Guest

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Hi Gary,

    Now that I read your 1st response again it is perfectly clear! <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Rather than doing nothing, how about moving back to the first cell in the table?

    Else
    ActiveDocument.Tables(1).Cell(1, 1).Select

    Note that if you had more than one table you may need to change the Table index.

  15. #15
    3 Star Lounger
    Join Date
    May 2001
    Location
    Burlington, KS, USA
    Posts
    209
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Tab key duplicates row in table (Word 2000 SR1)

    Even better:
    <pre> Else
    Selection.MoveDown Unit:=wdLine, Count:=2</pre>

    seems to work. Our unprotected cells are the only cells in the row (i.e., one cell spanning the entire width of the table). For some reason, it takes two down arrows to move from the unprotected cell to the next unprotected cell or field (the cursor appears to stop at the end of the row first, then go to the next cell/field).

    It achieves the desired result: The TAB key at least appears to be moving the cursor to the next field. Thanks for getting me started in the right direction!
    The postings on this site are my own and do not necessarily represent the position or opinion of WCNOC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •