Hello everyone,
How to use On Error GoTo statement in Word VBA more than one time? For example, when I don't select anything in Word and I used the command "Selection.Copy" then I would get the following error message:
but I can use On Error GoTo statment to deal with that. Now, the question is that if there is a possibility for happening more than one error how can I use the On Error GoTo statement more than one time, so when an error happens in the first time, then go to the first label, then in first label if an error happened again, then go to second label.
I tried the following code:
Sub Macro345()
Dim case1 As Label
Dim case2 As Label
On Error GoTo case1
Selection.Copy
case1:
MsgBox "case1"
Selection.Copy
On Error GoTo case2
Exit Sub
case2:
MsgBox "case2"
Exit Sub
End Sub
Does anyone know any way how to solve this problem?
Hi mister Hans,
I think this code will work, and I want to try it in the module in the editor, but now I have other big problem. Today I closed the windows of modules in the editor that contains the macros but then I cannot see them, I'm not sure if I can restore them.
let me create a special thread for that.