Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

Disabling "next cell" in a table

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
VBA Neophyte - 14 Feb 2008 19:46 GMT
I have a table divided into protected and unprotected sections.  In the
unprotected sections, when the user  tabs, a new line is created (as though
it were the end of the table).  I want to disable the "next cell" function in
these cases, or otherwise prevent the creation of a new row, or force
navigation to the next form field/section.  Any suggestions?

Thanks.
Shauna Kelly - 16 Feb 2008 10:04 GMT
Hi

See
Intercepting events like Save and Print
http://www.word.mvps.org/FAQs/MacrosVBA/InterceptSavePrint.htm

You can intercept the NextCell command. You'll have to write code that
determines when the user should be able to tab to the next cell and when
not.

Hope this helps.

Shauna Kelly.  Microsoft MVP.
http://www.shaunakelly.com/word

>I have a table divided into protected and unprotected sections.  In the
> unprotected sections, when the user  tabs, a new line is created (as
[quoted text clipped - 5 lines]
>
> Thanks.
Helmut Weber - 16 Feb 2008 11:37 GMT
Hi Neophyte,

something along these lines:

Sub NextCell()
Dim rTbl As Range
Set rTbl = Selection.Tables(1).Range
If Selection.Cells(1).Range.IsEqual( _
  rTbl.Cells(rTbl.Cells.Count).Range) Then
  MsgBox "lastcell"
Else
  Selection.Cells(1).Next.Select
  Selection.Collapse
End If
End Sub

HTH

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.