Problem solved. I combined file.exists and while loop to create version number. Thank you very much for your help. -- View this message in context: http://n4.nabble.com/Exporting-PDF-tp2015263p2015366.html Sent from the R help mailing list archive at Nabble.com.