WORD 97, number of rows in a table
Results 1 to 5 of 5

Thread: WORD 97, number of rows in a table

  1. #1
    Join Date
    Nov 2001
    Location
    chevy chase, md, usa
    Posts
    1,376

    WORD 97, number of rows in a table

    Using WORD 97 with a W98 pc ... is there a direct way for me to tell exactly how many rows I have in a very long table (perhaps 500 or so rows long)? Thanks. .... wdcl

  2. #2
    Join Date
    Feb 2001
    Location
    3rd rock from the Sun
    Posts
    1,320
    This macro code for WORD is one way.
    Code:
    Sub CountRowsInTable()
    ' Count total rows in table
    Dim RC As Long
        RC = 1
        ActiveDocument.Tables(1).Cell(1, 1).Select
        Do
            Selection.MoveDown Unit:=wdLine, Count:=1
            If Not (Selection.Information(wdWithInTable)) Then Exit Do
            RC = RC + 1
        Loop
        MsgBox RC & " Rows"
    End Sub
    Even though these two are listed for WORD 2000, they will also work in WORD97
    http://support.microsoft.com/?kbid=212720
    Last edited by oldhermit; June 28th, 2005 at 06:13 PM.

  3. #3
    Join Date
    Nov 2001
    Location
    chevy chase, md, usa
    Posts
    1,376
    OldHermit: Thanks for your suggestion. I only WISH I knew enough about macros to use it. Can you suggest an EASY way to learn them?

    FWIMBW to other novices, here is a simpleton way to count the rows: I built and saved a COUNTTABLE with 2 (or more) columns and 800 rows; and I numbered the rows in column 1. I highlight any column in the table to be counted; Ctrl-C; and paste it into column 2 of the COUNTTABLE. Not elegant but it works. ..... wdc

  4. #4
    Join Date
    Feb 2001
    Location
    3rd rock from the Sun
    Posts
    1,320
    I'm always for doing whatever works. Then improve if having difficulty living with it.
    Macros are not really that difficult, and extend the abilities of Word over what is commonly available in the main menu.

    There are various instruction pages on the Internet for working with macros, and for those with intentions of using MS Office extensively, then I would recommend taking the time to at least know how to implement and run macros. This list of step-by-step instructions for implementing a macro may be the easiest instructions to follow, which can be copied to any text editor.
    OK. You have a macro in front of you and would really like to run it, but these instructions from Microsoft didn't help any.
    http://msdn.microsoft.com/library/de...ner_macros.asp
    The following instructions may be easier to follow.

    First you need to know the name of the macro.
    The name of the macro is found on the very top line of the macro code, usually comprised of two or more words crammed together in front of a set of brackets, such as RunMyMacroNow
    1. Start recording a new macro. To do so, click TOOLS > MACRO > RECORD NEW MACRO
    2. This pops up a dialog box where you can type in the macro name, exactly as it appears in the macro code without the trailing brackets. Click the KEYBOARD button and enter a HOTKEY combination. This will be the shortcut key combination used to run the macro. Then click Close.
    3. There is usually a small box placed in view when you record a macro. Click the Stop Recording button now. If the small box doesn't show, then click TOOLS > MACRO > STOP RECORDING
    You have now told Word to recognize this macro, so now the macro has to be pasted into Word in order for it to run.
    4. Highlite and copy the macro code. Be sure to omit the first and last lines of the macro when you highlite and copy
    5. EDIT the macro code. Click TOOLS > MACRO > MACROS > EDIT
    6. You are now looking at the macro code you just recorded, so we have to add the code to it. Don't delete anything! Click the beginning of the line that says END SUB and press the ENTER key. This will move the line down one row, leaving a blank line.
    7. PASTE the code into the blank line. If any red lines show up or a message box appears, then there is an error in the code, and the macro won't run.
    8. Otherwise, if everything appears to be in order, then click FILE > CLOSE AND RETURN TO MICROSOFT WORD
    9. You should now be looking at the document again and you can now press the shortcut key combination to run the macro.

    BTW, depending on how complex the document is provisioned (some have UserForms, buttons, whatever), most macros and functions are written into a MODULE. That's where you will find them when opening the VB Editor and the code is not visible.

  5. #5
    Join Date
    Nov 2001
    Location
    chevy chase, md, usa
    Posts
    1,376
    On digging deeper, I find that one <should> be able to count the number of cells in a WORD97 table that are above a cetain cell by:
    - Clicking the cell where you want the result;
    - Entering (in Table) Formula and then COUNT(ABOVE).

    That seems to work for counts of 10 or 20 but does not work consistently for higher numbers. I must be doing something wrong but I can't see what.

    Is anyone familiar with this operation? Is there a WORD-specific help site that I should be querrying on these details? Thanks. ... wdc

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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