Dear i m trying to open a document in word which has got password. The problem is that if cancel button is pressed it gives run time error(4198) and if gives wrong password and presses ok button it gives run time error 5408.so now i want to trap these errors and so the message and exit sub .please help me. i m also sending u the code.The problem occurs in code where it tries to open the document.

With appWD.Application
.Activate 'MSWord is activated
.WindowState = wdWindowStateMaximize 'window is maximized
'Opens the required document (r/w)
.Documents.Open FileName:=txtResumeFileName.Text, ReadOnly:=False

End With


I m getting problem at .Open