Consulting

Page 3 of 3 FirstFirst 1 2 3
Results 41 to 53 of 53

Thread: Code Integration Query

  1. #41
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Here is a proof of concept for Deedii for using the native comparison feature, as well as a structure which (maybe) better articulates what I was talking about.

    It will work in both 2003 and 2010 (have not checked 2007, although I think it should work). The major difference is that in 2003, you would be forced to save two documents before completion (just save to desktop and delete afterwards-- code could easily be added to delete those "temp" files)
    Attached Files Attached Files

  2. #42
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    Quick note: this is just a proof of concept, because the major limiting factor here is the actual pasting of text into the text boxes of the form. That strips away formatting (which may or may not be important).

    Even if you added programmatic references to use a "rich text box" control (which are available somehow, but I haven't done something like that recently), I'm pretty sure you're going to lose at least some of what you think you might get, so I'm not sure what that would add in this kind of proof-of-concept.

    In any event... hope this helps you, Deedii.

    Fumei: I hope this at least identifies what I was talking about, structurally/conceptually.

  3. #43
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    Frosty thank you so much for your kind answer.
    Yes something like that only that I want to achieve the same result in the RTB as the code do the documents. BTW sorry to challenge you guys, but I really appreciate it a lot

  4. #44
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    There is no RTB available from VBA within a userform. C'est impossible.

    What version of Word are you using?
    What gave you the idea of a Rich Text Box?
    Why do you need the results in a form at all?
    We are trying to solve your problem for free, not meet your exact design requirements.

    What you want might be possible in a stand alone application (VB, .NET addin, a COM addin, etc)... But it is not available in VBA.

  5. #45
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    Thank you for that

    I am using 2007.
    Well the idea came to me since i think RTB can handle highlighting format.
    Coz I think it would be easier for me to count how many duplicated sentences.
    I know and Im very thankful for that, thats why I am open for a good suggestions from you guys .

    Hmm i didnt thought that this will be very complicated, I thought its easy to integrate. For now I am using it as is with some tweak from your idea and fumei and paul. It somehow manage to do things that I want to do so Im very thankful for you guys.

  6. #46
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    Frosty --

    There is no RTB available from VBA within a userform. C'est impossible.
    http://www.tek-tips.com/viewthread.cfm?qid=1544286

    So we are talking about VBA rather than VB ... OK, this is probably caused - would you believe - by Internet Explorer security.

    Basically the RTB is not trusted as safe by IE (the control itself is erroneously marked as safe but IE is configured not to believe it). Later service packs of Forms2 (also known as the Microsoft Office Forms Library, i.e VBA's userforms) check with IE on whether they are allowed load and run a control. The policy for the RTB is to NOT load or run it, because the 'killbit' is set in the registry. This killbit setting is not accessible through the IE interface, so there are two primary workarounds

    1) Use genuine VB6 to wrap the RTB in a usercontrol which you can mark as safe

    2) Edit the relevant killbit setting in the registry (normal warnings about modifying the registry apply):
    HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer\ActiveX Compatibility\{3B7C8860-D78F-101B-B9B5-04021C009402}
    and change the 'Compatibility Flags' value from 0x400 to 0
    Possible solution. Not great, but possible

    Paul

  7. #47
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    Hmmm this is very complicated than I thought. The main reason why I wanted to integrate that code instead of using it inside the document, because it doesnt really compare the two articles the (source) and the (article) it only look for duplicate inside the document even I separate the source page to article page. There are some instance that sentences can be repeated in the source so the result it will be highlighted (Please see attached file to see what I mean.). What I need actually is to compare two article for duplication, meaning even if sentences are repeated in the (source) it will not be highlighted, it will only be highlighted if it appear in the (article). Would it be possible to compare two documents instead of comparing page 1 to page 2 that will give me the same result? Or compare two pages only that the highlight in page 1 is all yellow and highlight in page 2 is all red using that code, meaning even if sentences are duplicated in the source page it will just highlight yellow and if it appears in the article page it will be highlighted red in the article page?
    Attached Files Attached Files

  8. #48
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Too bad there are not many copy editors anymore because it would be far cheaper to hire a copy editor to do what you seem to be asking. The development cost to come up with a robust solution is far higher. I for one can not afford to put more time into this.

  9. #49
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    @Frosty I was doing some test on the concept you gave and Im really impressed. I have one question will it be possible to display only duplicated sentence in the "compared document" pane?

    @Fumei Thank you so much for participating. I appreciate it a lot

  10. #50
    This thread catched up my attention as I was looking for the same macro to compare two documents for duplication. Upon reading all your post actually the solution for you deedii can be found
    h t tp://tinyurl.com/72sl6xs
    and its an open source for you to edit as you like, perhaps you know how to program.

    I was looking at the code and your right it actually dont compare, it just look for duplication inside the documents. If someone able to compare two documents and highlight result in other document like what the app i gave you do then I guess your problem is solved. I noticed frosty has a very good concept only that it will not give you the result you want as it uses compare features of the office itself, I dont know if it possible to tweak it just to display the duplication in the compared document pane as you stated. Hope there a check for duplication in Comparison Setting in the word review features. Another problem is setting the number of phrase/word to match or your NMin.

    Now the challenge for us is can we replicate
    h t tp://tinyurl.com/72sl6xs
    application in vba?

    PS: Sorry to put it in qoute Im still not allowed to post link.
    Last edited by bigJD; 02-17-2012 at 10:41 PM.

  11. #51
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    Exactly thats something like that bigJD.

    One last question before I marked it as solved.
    With the code posted on the first page. Im having a problem in the minimum string to be match which is the NMin variable, whenever I set it to any number says 5 or 7, it still does not follow it because I can still see two consecutive words or three consecutive words highlighted when it supposed to be 5 or 7 (depending on the value of NMin) consecutive words before it will be highlighted. Any solution for that to make it accurate? Thanks

  12. #52
    VBAX Master
    Joined
    Feb 2011
    Posts
    1,480
    Location
    The short answer is you can't make that NMin value perfectly accurate in the results. This is because your entire code structure is based on the Words collection.

    The "Words" collection (which is a collection of ranges of what Microsoft thinks are words) is not always accurate and is fundamentally broken. There are a number of flaws which is probably not that interesting to list. But I've been trying to think of a better approach for you, and I've come up empty.

    I was thinking there might be a way to use the document comparison function, and then simply discard the deleted text and inserted text, and simply highlight what is perceived as either a "Move" or exactly the same text... but even that would be limited, since you clearly want to be able to use the NMin value and have it be useful.

    I would recommend purchasing that 3rd party app which bigJD posted the pseudo-link to.

    Couple of notes on that: I'm not sure why he had to use tinyurl-- that seems shady to me. The actual link is to an external website which is selling a product which would seem to do exactly what you want.

    But generally when someone with a single post count gives a link to a product which is being sold, I begin to be cynical that the entire thread is about marketing.

    However, giving you the benefit of the doubt that this thread hasn't wasted our time as a marketing ploy... I think what you have currently is about as good as you're going to get. It would be possible to program it better, but I think you've guessed at this point that it isn't easy... and I simply don't have the time to work on this at the moment, when I have people wanting to pay me to program for them.

    Good luck!

  13. #53
    VBAX Regular deedii's Avatar
    Joined
    Dec 2011
    Posts
    50
    Location
    Thanks frosty I got the point
    BTW this is the link if I get it right removing the spaces on h t t p
    http://plagiarism.bloomfieldmedia.co...opyfind-4-1-0/

    I dont see any tool for sale there, and its even an open source application. I just dont get what you mean on your notes.

    Again thanks so much people

Posting Permissions

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