Pages in topic: [1 2] > | Export marked errors of spellcheck to separate document Thread poster: sentrodil (X)
| sentrodil (X) Türkiye Local time: 19:43
hi folks, I'm looking for a way to export all the errors in a Word file which have been marked as spelling errors into a separate document. Normally, I can go through the whole file with F7, and mark the word as "ignore" or "add" or "change" etc, but that takes long I've been looking for a way to "have all those words (and ONLY those words) in a separate file" any idea? macro? add-on (MS Office XP, 2003,2007, or 2010 is possible) thanks in advance ... See more hi folks, I'm looking for a way to export all the errors in a Word file which have been marked as spelling errors into a separate document. Normally, I can go through the whole file with F7, and mark the word as "ignore" or "add" or "change" etc, but that takes long I've been looking for a way to "have all those words (and ONLY those words) in a separate file" any idea? macro? add-on (MS Office XP, 2003,2007, or 2010 is possible) thanks in advance om ▲ Collapse | | | Endre Both Germany Local time: 18:43 English to German
Hello om, I use the following macro. You might want to adapt wdGerman at the end to your desired language. Endre Sub SpellingErrors_Collect() Dim rng As Range Set rng = ActiveDocument.Range Dim spErrors As ProofreadingErrors Set spErrors = rng.SpellingErrors Dim errorList As String Dim startTime As Date Dim endTime As Date Dim secondsDiff As Long ... See more Hello om, I use the following macro. You might want to adapt wdGerman at the end to your desired language. Endre Sub SpellingErrors_Collect() Dim rng As Range Set rng = ActiveDocument.Range Dim spErrors As ProofreadingErrors Set spErrors = rng.SpellingErrors Dim errorList As String Dim startTime As Date Dim endTime As Date Dim secondsDiff As Long startTime = Now Debug.Print startTime & ": Starting error collection." Documents.Add DocumentType:=wdNewBlankDocument Dim rngColl As Range Set rngColl = ActiveDocument.Range Dim i As Integer For i = 1 To spErrors.Count rngColl.InsertAfter spErrors(i) rngColl.InsertAfter vbCrLf If i Mod 50 = 0 Then endTime = Now secondsDiff = DateDiff("s", startTime, endTime) Debug.Print secondsDiff & " seconds: Done with " & i & " errors." End If Next endTime = Now secondsDiff = DateDiff("s", startTime, endTime) Debug.Print endTime & ": Done with all " & spErrors.Count & " errors in " & secondsDiff & " seconds." Selection.WholeStory Selection.ConvertToTable Separator:=wdSeparateByParagraphs, NumColumns:=1, _ NumRows:=532, Format:=wdTableFormatNone, ApplyBorders:=True, _ ApplyShading:=True, ApplyFont:=True, ApplyColor:=True, ApplyHeadingRows:= _ True, ApplyLastRow:=False, ApplyFirstColumn:=True, ApplyLastColumn:=False _ , AutoFit:=True, AutoFitBehavior:=wdAutoFitFixed Selection.Sort ExcludeHeader:=False, FieldNumber:="Spalte1", SortFieldType _ :=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending, FieldNumber2 _ :="", SortFieldType2:=wdSortFieldAlphanumeric, SortOrder2:= _ wdSortOrderAscending, FieldNumber3:="", SortFieldType3:= _ wdSortFieldAlphanumeric, SortOrder3:=wdSortOrderAscending, Separator:= _ wdSortSeparateByTabs, SortColumn:=False, CaseSensitive:=False, LanguageID _ :=wdGerman End Sub ▲ Collapse | | | sentrodil (X) Türkiye Local time: 19:43 TOPIC STARTER
Hallo Endre, great! Just what I was looking for. Is there any limitation about the document size it can handle?? regards, Omer | | | Endre Both Germany Local time: 18:43 English to German
No hardwired limitation that I know of, but it's getting slower with larger documents, and it may be unusable with really big ones. Depends on your machine as well. Endre | |
|
|
wotswot France Local time: 18:43 Member (2011) French to English Tweak to speed it up | Apr 6, 2012 |
Hi Endre and Omer, Try changing: For i = 1 To spErrors.Count to Dim nbSpe As Long nbSpe = spErrors.Count For i = 1 to nbSpe Standard good practice in VBA, since spErrors.Count is only evaluated once with this modification. Please tell us if this significantly speeds things up. Cheers Richard | | | Endre Both Germany Local time: 18:43 English to German
Hello Richard, Thanks for what is indeed good practice for squeezing out the last bit in performance. However, if I remember correctly from the time of coding, the main culprit is Word's slow access to the SpellingErrors collection (which is getting perceptibly slower with bigger documents until it crawls to a halt). Endre | | | sentrodil (X) Türkiye Local time: 19:43 TOPIC STARTER change according to language | Apr 6, 2012 |
thanks for both of you. Richard, as I'm a layman in terms of VBA, could you list the whole macro with the change you mention implemented into it? When I just replaced the line with your 3 lines, it gave an error. Another thing - instead of having several of the same macro for several languages or changing wdGerman etc. at the end manually, would it be possible to (meaning: please could you) change this macro so it will determine the language (not by the automatic langua... See more thanks for both of you. Richard, as I'm a layman in terms of VBA, could you list the whole macro with the change you mention implemented into it? When I just replaced the line with your 3 lines, it gave an error. Another thing - instead of having several of the same macro for several languages or changing wdGerman etc. at the end manually, would it be possible to (meaning: please could you) change this macro so it will determine the language (not by the automatic language determination of Word, but using the language which we have set using "Set Language")??? I'm looking for something that can use the set language directly... ?? ▲ Collapse | | | wotswot France Local time: 18:43 Member (2011) French to English Speed limitation | Apr 6, 2012 |
Hi Endre and Omer, I totally agree Endre, here we've reached the limit of what Word allows; apart from my small tweak, I see no other way of speeding it up in VBA/Word. The only way would be to write an executable (in .NET for instance), but that's a major project and even then it's highly unlikely that it would be any faster than what Microsoft has been able to achieve! That's just the nature of the beast. Spelling is a huge and complex area. ... See more Hi Endre and Omer, I totally agree Endre, here we've reached the limit of what Word allows; apart from my small tweak, I see no other way of speeding it up in VBA/Word. The only way would be to write an executable (in .NET for instance), but that's a major project and even then it's highly unlikely that it would be any faster than what Microsoft has been able to achieve! That's just the nature of the beast. Spelling is a huge and complex area. One avenue that may be worth exploring in VBA is the Revisons collection (turn on track changes, correct spelling mistakes, process the Revisions collection), but that would still require the user to interactively correct all the spelling mistakes first. Omer, I'll try and find the time to do what you asked (tweak the code, detect language automatically, etc.), if Endre hasn't already done so! Can we go back to the beginning and ask why you need all and only the spelling errors in a separate document? Sometimes a bit of lateral thinking helps to bring out unexpected or alternative solutions. Cheers Richard ▲ Collapse | |
|
|
sentrodil (X) Türkiye Local time: 19:43 TOPIC STARTER shortening the work | Apr 6, 2012 |
Hi Richard, I'll be using it to add words into the custom dictionary/glossary of MS Word. During review, we have to add the new words which are actually no spelling mistakes into the custom dictionary/glossary of MS Word. It is not that much in English, but for Turkish the amount is much higher and for German it is gigantic. So in most cases we have to add the German words which are taken as spelling errors into the custom glossary one by one before we can see if it is a "normal" er... See more Hi Richard, I'll be using it to add words into the custom dictionary/glossary of MS Word. During review, we have to add the new words which are actually no spelling mistakes into the custom dictionary/glossary of MS Word. It is not that much in English, but for Turkish the amount is much higher and for German it is gigantic. So in most cases we have to add the German words which are taken as spelling errors into the custom glossary one by one before we can see if it is a "normal" error. It would help to have them listed separately (exactly as Endre's macro - thanks again!), then add them into the glossary, and see only "real" typos in the main document. If it is too much to be handled with VBA to have Word "see" which language we have set the document to, and use that as the "wdLANGUAGE" at the end, I'm happy to be at least able to create different macros for different languages. many thanks again!! Omer ▲ Collapse | | | An other option | Apr 6, 2012 |
With all the spelling mistakes underlined, save the file as a Webpage, open it in Notepad(++), select all and copy it in a new Word file. Before opening the new file do not forget to uncheck ongoing spell checking at Tools/Options otherwise the process will take hours! In Word, go to Edit/Replace, check Wildcard and Find: (*)(SpellE\>)([A-Za-z]{1,})(\<) Replace with: \3^13 to get the list of mispelled words. Delete everything... See more With all the spelling mistakes underlined, save the file as a Webpage, open it in Notepad(++), select all and copy it in a new Word file. Before opening the new file do not forget to uncheck ongoing spell checking at Tools/Options otherwise the process will take hours! In Word, go to Edit/Replace, check Wildcard and Find: (*)(SpellE\>)([A-Za-z]{1,})(\<) Replace with: \3^13 to get the list of mispelled words. Delete everything that is below the last mispelled word in the list. To collect a list of 1000 „spelling mistakes” from a 60,000 word part of a book that had been written in old style took 5 sec. ▲ Collapse | | | sentrodil (X) Türkiye Local time: 19:43 TOPIC STARTER |
The formula you used seems correct, so I can think of only one thing: I described the general ("international") syntax of the expression; however, as far as I know, in some countries (including Hungary) during localization comma has been substituted with semicolon in the syntax, so instead of {1,} try to use {1;} and let me know if it still refuses to work. | |
|
|
sentrodil (X) Türkiye Local time: 19:43 TOPIC STARTER
Dear István, test results: changes , to ; but 1 - with spell checking unchecked nothing changes after 10 minutes 2 - spell checking not unchecked it says "found 0 changes" tried it with Word 97 and Word XP | | | It works for me | Apr 9, 2012 |
If it is possible, please send me ([email protected]) a part of the original document which is not sensitive and the spelling mistakes are marked, to have a closer look and find the differences. | | | Max Masutin Ukraine Local time: 19:43 English to Russian + ... This must work for any language | Apr 13, 2012 |
Sub Errors_to_File() Dim rng As Range Set rng=ActiveDocument.Range Dim spErrors As ProofreadingErrors Set spErrors=rng.SpellingErrors Dim errorList As String Dim startTime As Date Dim endTime As Date Dim secondsDiff As Long startTime=Now Debug.Print startTime & ": Starting error collection." Documents.Add DocumentType:=wdNewBlankDocument Dim rngColl As Range Set rngColl=ActiveDocument.Range Dim i As Integer ... See more Sub Errors_to_File() Dim rng As Range Set rng=ActiveDocument.Range Dim spErrors As ProofreadingErrors Set spErrors=rng.SpellingErrors Dim errorList As String Dim startTime As Date Dim endTime As Date Dim secondsDiff As Long startTime=Now Debug.Print startTime & ": Starting error collection." Documents.Add DocumentType:=wdNewBlankDocument Dim rngColl As Range Set rngColl=ActiveDocument.Range Dim i As Integer Dim nbSpe As Long nbSpe=spErrors.Count For i=1 To nbSpe rngColl.InsertAfter spErrors(i) rngColl.InsertAfter vbCrLf If i Mod 50=0 Then endTime=Now secondsDiff=DateDiff("s", startTime, endTime) Debug.Print secondsDiff & " seconds: Done with " & i & " errors." End If Next endTime=Now secondsDiff=DateDiff("s", startTime, endTime) Debug.Print endTime & ": Done with all " & spErrors.Count & " errors in " & secondsDiff & " seconds." Selection.WholeStory Selection.Sort SortFieldType _ :=wdSortFieldAlphanumeric, SortOrder:=wdSortOrderAscending End Sub I don't know any programming and deleted obvious code for: creating a table, because you just need a list, and unnecessary sorting. The original code contains a value specific to German - Spalte1. This may be why it didn't work for you. The credit goes to the original code donators. ▲ Collapse | | | Pages in topic: [1 2] > | To report site rules violations or get help, contact a site moderator: You can also contact site staff by submitting a support request » Export marked errors of spellcheck to separate document Wordfast Pro | Translation Memory Software for Any Platform
Exclusive discount for ProZ.com users!
Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value
Buy now! » |
| CafeTran Espresso | You've never met a CAT tool this clever!
Translate faster & easier, using a sophisticated CAT tool built by a translator / developer.
Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools.
Download and start using CafeTran Espresso -- for free
Buy now! » |
|
| | | | X Sign in to your ProZ.com account... | | | | | |