View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Paul Wagstaff Paul Wagstaff is offline
external usenet poster
 
Posts: 3
Default Error trapping don't work

Hi all,

A colleague at work has an xl file that is linked to about 10 other
password-protected files over a winNT network. He want those files opening
without having to laboriously type in passwords in order to update his
master copy. The code below does work (it's behind a third file called
CodeFile.xls, but when i attempt to error trap I receive the usual Debug |
End |Help dialog box. Please can someone help as the vba is useless without
knowing which, if any, files failed to open (i.e. cos they were moved,
changed, deleted by other users).

Private Sub CommandButton1_Click()
On Error GoTo ErrorHandler

Workbooks.Open Filename:="blah\blah\Link.xls", updateLinks:=3, _
password:="gollum"
Workbooks.Open Filename:="blah\Master.xls", updateLinks:=3

Workbooks("Link.xls").Close

Exit Sub

ErrorHandler:
Select Case Err.Number

Case 1004
MsgBox "The file Could not be found", vbOKOnly + vbCritical, "Error"

Case Else
MsgBox (Err.Number & Err.Description)
End Select
Resume Next

End Sub