The code works perfectly until it hits runtime error 5138
Hitting debug then points me to
Code:
.PageSetup.DifferentFirstPageHeaderFooter = True
Still, this is much better than doing things manually and if there is no fix I will just find a way to discover which document is the problem and just do it manually.
Thank you.
Edit:
I found the problem there are some weird documents with impossible margins, and I found a way to mass rename and remove the special chars from the filenames, the code is working as intended, thank you for your help!