I am using the following code I found online to create and email a PDF of one of my sheets:
The code runs from a command button in a userform, and it works fine. However after clicking the command button if the user clicks anywhere in the workbook before the code completes then it stops the code from completing. The user is then left with a duplicate copy of the workbook open titled 'Workbook', and the main workbook is closed (which easily causes confusion).
Is there away I can prevent this from happening by allowing the user to click on the workbook without it interfering, or if this is not possible then somehow temporarily disable the mouse pointer and keyboard so the user is not able to accidentally interrupt it?
Bookmarks