access violation 0cx0000005 in vba excel

N

ngm

Dear recipient:

I have this error access violatio 0cx0000005 to open file excel,
generate this file in code vba.Don't have idea where is the error.

I have a next code fragment

For p = 0 To num_pems - 1
Workbooks(libro_paquete).Activate
Sheets("MFisicas " & pems(p)).Select
MsgBox "pem i" & pems(p)
Sheets("MFisicas " & pems(p)).Delete
Next
Application.DisplayAlerts = True


Workbooks(libro_paquete).Save
Workbooks(libro_paquete).Close

if elimite the sentence for to open file correct.

Can you help me please?

Regards
 
Top