Results 1 to 2 of 2
2002-05-29, 13:57 #1
- Join Date
- Apr 2002
- 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)
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.
2002-05-29, 14:09 #2
- Join Date
- Mar 2002
- 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
On Error Goto <label>
at the point where you want error handling again.