0
votes

For my problem I tried different things and none worked: I am flexible about the way to actually solve it, so I think it's best to begin with the purpose.

I get long word files and I need to do some quality checks and proofreading. There are a lot of words in the file that are not capitalized correctly. I want to get this in automatic (no a normal grammar software/add-on won't do)

I have all the entries in my auto correct file, in word files (quite huge better not use them) and in an excel spreadsheet (wrong entry - correct entry).

Refreshing the document doesn't do the trick. If I pick a word from the list and select it and press the space-bar then it gets changed so I "wrote" a Macro for that

Sub Try()
    For Each sentence In ActiveDocument.StoryRanges  
        For Each w In sentence.Words            
            Selection.MoveRight Unit:=wdWord, Count:=1
            Selection.TypeText Text:=" "
            Selection.TypeBackspace          
        Next
    Next
End Sub

The thing "worked" i.e. it runs and you can see the cursor speeding through the screen but no words get changed. So I am thinking that Autocorrect get's somehow disabled while Macros are running.. Anyone has a hint? ideally knows a way around it?

Worst case I thought of putting the text in an excel file and writing a macro that for each line of text checks each word against my original list and "if match then substitute" but it doesn't seem too easy (at least for me)

Cheers
I hope that I could explain myself

1
Um... all your code is doing is adding a space between words and then removing it again... your question is NOT clearSlowLearner
yep tha's why I call this "code" and that was the idea since when doing that usually the autocorrect function kicks in leaving the original text otherwise unchanged; but Autocorrect doesn't get activated this way because I think it's suspended when a macro is runningNicholas_Zgb
Oh... I see... you were hoping that by modifying the text like that, that the auto correct would be invoked and make the correction. Sorry, that won't happen while the code is running. You will need to use a find and replace macro for that...SlowLearner
Exactly... well thank you for your answer :) I haven't done much for the excel macro because I was hoping to find a way around it :-/ So probably it's too early to ask questions about that. Anyway if you have any general suggestion I'm grateful to hear about it; otherwise I'll post again when I get a bit of work done :)Nicholas_Zgb
see my Answer, hope it helps :)SlowLearner

1 Answers

1
votes

This Pseudo Code / Outline should get you started:

In Word you can create an instance of Excel and open your spreadsheet:
https://stackoverflow.com/a/24196120/3451115

You can then Loop through your list of WrongWords:
https://stackoverflow.com/a/1463308/3451115

For each WrongWord do a Find and Replace:
VBA to find and replace a text in MS WORD 2010