-
Solved: Using Document.Words Object in VBA
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?
[VBA]
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
[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules