if I understand your code correctly you are checking each line by regexp with the purpose of removing any line with unprintable characters.
The thing is that in this case the regexp found non so it never got to the section that sets d to something else than the original "nothing" value.
the If x.Test(c.Value) Then in this case is never true, so when it gets to the d.EntireRow.Delete, d = nothing and does not have any line value.
assuming your regex is done correctly, you should check d's value and if d="nothing" then you should skip the delete or have something else.
If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.
The thing is that in this case the regexp found non so it never got to the section that sets d to something else than the original "nothing" value.
the If x.Test(c.Value) Then in this case is never true, so when it gets to the d.EntireRow.Delete, d = nothing and does not have any line value.
assuming your regex is done correctly, you should check d's value and if d="nothing" then you should skip the delete or have something else.
Good luck.
-=Yuval=-