Consulting

Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 21 to 40 of 51

Thread: verify start and end tags

  1. #21
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    if <Amend> is found then before next <Amend> should find </Amend> else give me an error and select <Amend> that does not have matching pair

    Would be cool if I could tell the computer just that and he would understand
    Anyway I will try and let you guys know how far did i manage to come

  2. #22
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    is it possible to find one start tag and then another one and then check if between those two there is an end tag?? Or this can not be done this way

  3. #23
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    how is this done: find <Amend> and then another <Amend> and select all the text beetwen these two codes including codes and then search in this selection if </Amend> exists and if exists move and find another instance like this and so on till end of the document ?????? Any suggestions

  4. #24
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    OK...all right, all right. Geeeez. I have no real use for this, but because it seems to be a big issue, I will write a SMALL portion of this to give you an idea of how it could be done.

    I can not do this immediately, but I will do it shortly. As stated, it is not really difficult, just boring and tedious.

    Give me a day or so. I will use your sample doc to demonstrate.

  5. #25
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Oh, and md has the correct idea. It would be MUCH MUCH better to have correct input in the first place. Put in proper opening and closing tags.

    Which brings up a point....how are the tags being inserted in the first place????

  6. #26
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Here is a simple way to add your tags.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  7. #27
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    Thnx gerry

  8. #28
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    I know it would be better to have correct input but that is the problem I do not make this documents I just get them from other translation divisions and distribute them to our translators.

  9. #29
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Yeah....well, I have started on this. Yikes! So far I have a UserForm that lists ALL tags (in order) so it is fairly easy to see errors; as well as a list of tags by type. Now comes the tricky part of actually doing the logic. As stated....tedious and boring.

    To make the demo easier (on me) I am NOT going to make it recursive and check tags within tags. In other words, I am NOT going to check nestings - which if you want a full parsing I would suggest this actually get done. (Good luck with that....) But I ain't gonna do it.

    This is pretty complex and I am not sure how long this will take, as I have other more.....hmmmmm....crucial tasks that need to get done.

    Patience.

  10. #30
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    np
    Just check the Amend tags i dont need to know if tags inside are correct

    thnx again

  11. #31
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    any luck Gerry?

    thnx for all your help
    saban

  12. #32
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    just one question

    when I loop throgh text looking for </Amend> when it is found i 'do something
    then i search further. But how can I find one more time this same </Amend>
    (Not to find another instance of </Amend> but the same as previous and after i have found it 2 times i move to the next instance

    Thnx

  13. #33
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    see your other thread

  14. #34
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    did you manage yet to write code for <Amend> checking

    Thnx

  15. #35
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Saban,
    I'm playing around with some code. Do you have a larger sample to test.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  16. #36
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Try the attached. Run Tags in the Word document. To help track down the error, paste the result from the output document into Cell A1 in Excel and run the Layout code.
    Last edited by mdmackillop; 01-31-2006 at 02:45 PM. Reason: Attachment updated. Excel file added.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  17. #37
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location

    sample

    thanks for all your help
    Here is the large sample

  18. #38
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    i get subscript out of range in :
    [VBA]Selection.TypeText MyData(i, 1) & vbCr[/VBA]

  19. #39
    VBAX Mentor
    Joined
    Jan 2006
    Posts
    348
    Location
    any ideas why

  20. #40
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    If you run my original code and paste the result into the spreadsheet of my last attachment, a quick inspection shows that \Amjust is missing. My later code identifies another error, an extra bracket two lines before the last table on Page 5. I'm looking into ways of highlighting the errors, to save the manual inspection.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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