Results 1 to 11 of 11
  1. #1
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Limit a table to n rows, Limit a doc to a page (Word 2003)

    Dear Loungers,

    Is there a simple way to "freeze a table definition, in this case such that it remains at 5 rows as in the template. I could turn the template into a form I suppose. Are there any other solutions?

    And related to this (only because it's the same template) is there a way I can limit a document to one page. the only way I can think to do this is test the number of pages before saving and grumble at the user so he has to adjust before the document allows him to save & exit. Any other ideas?

    thank you.......... liz

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Limit a table to n rows, Limit a doc to a page (Word 2003)

    Educating the users about the purpose of the template is probably the best solution, but it's not water tight, of course.

    If it is acceptable to place the table in a section that is protected for forms, that's the easiest way to guarantee that the user cannot change the structure of the table. Otherwise, you'd have to check the number of rows before saving, in addition to checking the number of pages in the document.

  3. #3
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Hans,

    I can't beleive how generous you are with your time and expertise - and this is true of the other regular experts on this site!

    thank you once again.

    liz

  4. #4
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Hans,

    Educating would be a really good idea but whilst I am doing this now it is a company where a lot of the junior staff come and go se it needs to be quite resiliant. What I discovered is that once the form is protected this also locks the style and in several fields the user will need to used mixed styles. The only solution I can see is that we have a macro on entry to unlock the form and therefore allow styles formatting and one on exit to relock the form. Does this seem a reasonable approach or are there drawbacks or better option?

    UPDATED: this won't work since a field can only have one style applied to it however many paragrphs there are. So what other options do I have?

    liz

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Word hasn't been designed to do what you want. I think the only option is not to use a form and to leave the entire document unprotected, and to check before saving.

  6. #6
    New Lounger
    Join Date
    Jul 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Hi Liz,

    For the table thing, would something like this work?

    Trap Word's relevant built-in commands and override them with your own.

    E.g., in the template have macros something like ...

    Sub TableInsertRow()
    MsgBox "No way!"
    End Sub

    Sub TableInsertRowAbove()
    MsgBox "Hands off!"
    End Sub

    Sub TableInsertRowBelow()
    MsgBox "Aarrghh!!!"
    End Sub

    Sub TableDeleteRow()
    MsgBox "No you don't!"
    End Sub

    Sub EditPaste()
    If Selection.Information(wdWithInTable) Then
    MsgBox "Gotcha!"
    Else
    Selection.Paste
    End If
    End Sub

    Regards.

    Ed

  7. #7
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Ed,

    looks hopeful I'll try iy, thanks

    liz

  8. #8
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Ed,

    great it works... but the commonest way of extending a table is to press the tab key. I'm not sure if I need to capture the user being in the table and presing tab at th end of the table of does that action invoke an inbuilt command?

    thank you...... liz

  9. #9
    New Lounger
    Join Date
    Jul 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Hi Liz,

    One way to tell what command a menu item or shortcut runs is to hold down Ctrl+Alt and press the plus key on the numeric keypad; when the cursor resembles a four-leaf clover, click the menu item or use the shortcut and a dialog opens which shows the command. Doesn't work for everything, though.

    Something like this might work ...

    Sub NextCell()
    Dim CurrCol As Integer
    Dim CurrRow As Integer

    CurrCol = Selection.Information(wdStartOfRangeColumnNumber)
    CurrRow = Selection.Information(wdStartOfRangeRowNumber)

    If CurrCol = Selection.Tables(1).Columns.Count And CurrRow = Selection.Tables(1).Rows.Count Then
    MsgBox "Stop that!"
    Else
    Selection.MoveRight unit:=wdCell
    End If

    End Sub

    Regards.

    Ed

  10. #10
    4 Star Lounger
    Join Date
    Nov 2002
    Location
    London, Gtr London, England
    Posts
    496
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Ed,

    Should have said thank you earlier it all works perfectly and I added columns and cells and tables actions as well

    liz

  11. #11
    New Lounger
    Join Date
    Jul 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Limit a table to n rows, Limit a doc to a page

    Liz,

    Glad you got it to work.

    Regards.

    Ed

Posting Permissions

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