Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Apr 2002
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Read from autocorrect entry (Word 2000)

    I want to check if an entry exists in the autocorrect entry. If the entry does not exist, I don't want to add some entry. If the entry does exist, I want to add some entry. The following code works fine, if the entry does exist, but does not work if the entry does not exist.

    strTest = AutoCorrect.Entries(myString).Value
    If strTest <> "TestString" Then
    For I = 0 To 12
    AutoCorrect.Entries.Add Name:=strString1(I), Value:=strString2(I)
    Next
    End If


    The problem is the the first line of the code strTest. If the entry exists in the autocorrect entry,the code runs fine. If the entry does not exist, I receive an error emssage. I want to know how can I change the first line of the code so that when the entry does not exist so I don't receive an error message.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Read from autocorrect entry (Word 2000)

    Put the instruction

    On Error Resume Next

    before the offending line.

    This means that errors won't cause an error message. You can still inspect the Err object to see if an error occurred. If Err = 0, all went fine, but if Err <> 0, then something went wrong.

    If you want to turn on error handling again, put an instruction

    On Error Goto 0

    or

    On Error Goto <label>

    at the point where you want error handling again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •