I’m writing some Excel code to generate a password protected PDF using VBA. It’s working so far except I don’t want the current PDF viewer opening after the file is saved. However, when I add the following line to my script, I get an run-time error:
PrintJob.SetProfileSetting "PdfSettings.OpenViewer", "false" PrintJob.ConvertTo SavePath
At this point, Excel is broken and I have to exit Excel and re-load. Comment the line out and it works fine.