The modified code will not try to add an (invalid) print area to an unnamed worksheet, avoiding the unhandled exception.