Consulting

Results 1 to 14 of 14

Thread: Word Instructions Document in Tables - Find Duplicate Steps

  1. #1

    Word Instructions Document in Tables - Find Duplicate Steps

    I have a Word document (one of many) (150 + pages) which is laid out in tables in the document. I can delete the initial pages to reduce the main content to the tabular content. Every table row has either 2 columns or 3.


    Col1 = Step No.
    Col 2 = Instruction (long complex text >255 chars) which can also contain a blank sub-table
    Col 3 = Text with underlining and space for someone to sign for the instruction


    I'm looking for a macro to read every row in every table in the document to search for an identical entry (excluding Col 1 as this is unique). Note: these tables could be broken with a carriage return in places throughout the document.


    Is this something that anyone can help me with?

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,407
    Location
    You say:
    these tables could be broken with a carriage return in places throughout the document
    In that case, you're no longer dealing with one table, but with two or more. It's not apparent how a macro is supposed to tell whether it has encountered such a table (or table series). While that might be apparent to you visually, macros don't 'see' anything.

    Furthermore, you would need to tell us:
    How many rows in each table?
    In a 3-column table, do columns 2 & 3 both have to match, or only one of them?
    What you want done when a duplicate is found?
    Last edited by macropod; 08-29-2022 at 07:04 AM.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Yes, columns 2 and 3 would have to match where the row has column 3. The document is one big table...but for formatting, some are broken across pages with CR. If macros cannot see the CR break in a table, then that is better..it will move to the next table row? I was concerned it would break the execution. The number of rows is a variable (this particular document has 136 numbered steps). I'd like the colour to change and have some way to log the other step numbers that are duplicates.

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,407
    Location
    Quote Originally Posted by Dembones View Post
    The document is one big table...but for formatting, some are broken across pages with CR.
    This statement is not consistent with your earlier advice:
    Quote Originally Posted by Dembones View Post
    I have a Word document (one of many) (150 + pages) which is laid out in tables in the document. ... Every table row has either 2 columns or 3.
    Is it one big table, or many tables?

    Likewise:
    Quote Originally Posted by Dembones View Post
    for formatting, some are broken across pages with CR. If macros cannot see the CR break in a table, then that is better..it will move to the next table row?
    is not consistent with:
    Quote Originally Posted by Dembones View Post
    I have a Word document (one of many) (150 + pages) which is laid out in tables in the document. ... Every table row has either 2 columns or 3.
    Carriage returns do not break a table and should not be used the way you have done. Ever heard of formatting paragraphs with the 'page break before' attribute? Carriage returns used the way you have done will definitely impact a macro that's doing comparisons.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    The document was formatted by others. Happy to upload it if you have a dropbox or something.

  6. #6
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,235
    Location
    Just a sample will be fine
    Remember To Do the Following....
    Use tags when posting code to the thread,
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  7. #7
    Please refer to the attachment
    Attached Files Attached Files

  8. #8
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,235
    Location
    Quote Originally Posted by Dembones View Post
    I'm looking for a macro to read every row in every table in the document to search for an identical entry (excluding Col 1 as this is unique).
    Sorry but your description here is a little confusing. In what you refer to as Column 3 has repeated entries "Performed By" and "Date". I assuming that the individual tasks as indicated by the detailed instructions in Column 2 may well be repeated on the same day and or by the same person, just exactly what are you searching for again? Are you trying to proofread the instructions to see if they are being repeated?
    Remember To Do the Following....
    Use tags when posting code to the thread,
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  9. #9
    The text in column 2 and 3 (if col 3 exists) is repeated later in the document. I want to colour code the repeated instances and know the step number is it is more than once.

  10. #10
    Hi. Are you able to help with this at all? Thanks.

  11. #11
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,235
    Location
    I must admit I thought Macropod would have been all over this since its a word issue.... maybe a little nudge is in order.
    Remember To Do the Following....
    Use tags when posting code to the thread,
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  12. #12
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,407
    Location
    Sorry, but that document doesn't have
    one big table...but for formatting, some are broken across pages with CR
    what is has is a plethora of tables split by manual page breaks, with text like 'Step 4 Continued:', inconsistent column layouts - up to 5 of varying widths, in fact - and that's before we even consider nested tables, of which there are many. Even within cells, varying numbers of paragraph breaks are used to force a bottom alignment instead of using Word's table cell vertical alignment options.

    In other words, from a programming standpoint your document is a dog's breakfast. Coding around all the inconsistencies would require more effort than checking the document manually. Someone really needs to spend some time learning how to do do document layout consistently, using Word's formatting tools instead of hard-formatting things and inserting page breaks, etc. where they aren't needed.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  13. #13
    OK. Thanks all for looking at it. We'll give up on it.

  14. #14
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,235
    Location
    Why give up on it? Simply redesign the document
    Remember To Do the Following....
    Use tags when posting code to the thread,
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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