Try something like this:
[vba]
Dim ErrorMessage As String
Dim ErrNum As Long

On Error Resume Next
Workbooks.Open Filename:=M1
ErrNum = Err.Number
On Error GoTo 0

If ErrNum <> 0 Then
ErrorMessage = ErrorMessage & vbNewLine & M1
Else
'The rest of your code for this file here
End If

On Error Resume Next
Workbooks.Open Filename:=P1
ErrNum = Err.Number
On Error GoTo 0

If ErrNum <> 0 Then
ErrorMessage = ErrorMessage & vbNewLine & P1
Else
'The rest of your code for this file here
End If


'More Code Here

If Len(ErrorMessage) > 0 Then
'There were some errors
MsgBox "The following files could not be accessed:" & vbNewLine & _
ErrorMessage, vbInformation, "Error Message"
End If
[/vba]