Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.tables
|
|||
|
|||
Stop adding rows to end of table
Hi olwenh,
if it has to be, you may define a global variable R of allowed rows for a table, also a global table object T. And in addition a selection-change event, which checks the number of rows in T. I don't think you can prevent the adding of a row, but you may delete the last row, immediately after it was created. ' ---------------- NewMacros Option Explicit Dim oAppClass As New ThisApplication Dim R As Long Dim T As Table Sub Macro1() ' Or autoexec, autonew or whatever Set oAppClass.oApp = Word.Application Set T = ActiveDocument.Tables(1) R = T.Rows.Count End Sub Sub Test4() If T.Rows.Count R Then T.Rows.Last.Delete End If End Sub ' ----------------------- ThisApplication Option Explicit Public WithEvents oApp As Word.Application Private Sub oApp_WindowSelectionChange(ByVal Sel As Selection) Test4 ' or the code of Test4 End Sub A weird workaraound, sure. -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adding rows to a table | Tables | |||
Adding rows to a table | New Users | |||
Why do rows in a table stack when adding a new row? | Tables | |||
Q: Automatically adding form fields to new rows in table | Tables | |||
Adding multiple rows to a table in Word? | Microsoft Word Help |