Hello
I have written the below code to write all words from MainDocument.doc to ChangeLog.txt. It should bypass the punctuation marks. But it isn't working. I don't know why. Any idea?
I have written the below code to write all words from MainDocument.doc to ChangeLog.txt. It should bypass the punctuation marks. But it isn't working. I don't know why. Any idea?
Code:
Sub DictionaryCompare()
Dim docCurrent As Document
Dim LookupWord As Object
sMainDoc = "C:\Dictionary\MainDocument.doc"
Set docCurrent = Documents.Open(sMainDoc)
docCurrent.Activate
For Each LookupWord In docCurrent.Words
If LookupWord <> vbCr And LookupWord <> "." And LookupWord <> "," And LookupWord <> ";" And LookupWord <> "?" And LookupWord <> "'" Then
Open "C:\Dictionary\ChangeLog.txt" For Append As #2
Write #2, Trim(LookupWord) & "," & FontColor & "," & PartOfSpeech
Close #2
End If
Next
End Sub