deleting unknown words in MS Word

Hi there,
in fact I'm a c++ coder, but i need a vbscript for
MS Word that deletes all words (from a wordlist), that
are unknown to the spell-checking...
can anybody help me?
THNX

bitWISEr

Comments

  • : Hi there,
    : in fact I'm a c++ coder, but i need a vbscript for
    : MS Word that deletes all words (from a wordlist), that
    : are unknown to the spell-checking...
    : can anybody help me?
    : THNX
    :
    : bitWISEr

    Not really into the script thing.. but you could adapt this.

    [code]
    Dim objword As Word.Application ' remember to add your word reference
    Dim FileName As String ' path and filename
    Dim j As Long

    Static myKeywords(0 To 3) ' increase as you add my keywords
    myKeywords(0) = UCase("John_Leslie")
    myKeywords(1) = UCase("Drinking")
    myKeywords(2) = UCase("Prohibition")

    Set objword = CreateObject("Word.Application")

    FileName = "c: emplee.doc" ' modify to your doc name.

    objword.Documents.Open FileName

    Do Until j = 4

    If InStr(1, UCase(objword.ActiveDocument.Content), myKeywords(j)) > 1 Then
    Debug.Print myKeywords(j) & " " & "Exists In " & FileName

    ' you need to use the Replace Function here...

    End If

    j = j + 1

    Loop

    objword.ActiveDocument.Close (False) ' dont save changes if it as old version of word

    objword.Quit

    Set objword = Nothing
    [/code]

  • Err this code looks like I have to write a list
    of words that exist, but that is exactly, what
    I want to avoid, I want to use the spell checking
    list from MS Word...
    THNX & CU
    ________
    bit[b][red]WISE[/red][/b]r

  • : Err this code looks like I have to write a list
    : of words that exist, but that is exactly, what
    : I want to avoid, I want to use the spell checking
    : list from MS Word...
    : THNX & CU

    mmm. sorry, but you did say word list. anyway.. look up the docs on spell checking in word with vb. i just looked on google.com

    it is not difficult to understand.

    regards

    dr k. groomgargler

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories