Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber Helmut Weber is offline
external usenet poster
 
Posts: 139
Default 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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding rows to a table Peter Guest Tables 2 November 25th 06 07:49 AM
Adding rows to a table Peter Guest New Users 3 November 22nd 06 08:01 PM
Why do rows in a table stack when adding a new row? Dottie in Asheville NC Tables 2 March 26th 06 11:59 PM
Q: Automatically adding form fields to new rows in table Richard J Tables 1 December 29th 05 03:10 PM
Adding multiple rows to a table in Word? Iron Mt Library Guy Microsoft Word Help 3 February 5th 05 12:08 AM


All times are GMT +1. The time now is 09:28 AM.

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"