Function GetDocSafely(db As NotesDatabase, unid As String) As NotesDocument On Error 4091 GoTo Error4091 Set GetDocSafely = db.GetDocumentByUNID(unid) Exit Function Error4091: Set GetDocSafely = Nothing Exit Function End Function