Could you tell us what goes wrong? Could you remove the "'On Error ResumeNext" to see where the error is?