Its very simple, i'd like to create a form that has a list of checkboxs relating to tasks that the user has to accomplish themselfs on the document. When they do what the form requests, they will then tick the check boxs and the code will finish. Its basically a (Checkbox)task list that has to be completed before the code can finish.
The first part is easy - create a userform in VBA that has your checkboxes, and insert a
userform.show vbModeless
in the appropriate place of your code. That might be the Workbook_Open event handler, if you want to display the form from the get-go.
In the userform.initialize method, for good measure, I'd put code to set all the checkboxes to false (unchecked).
In each of the userform.checkbox#.change events, check whether all checkboxes are checked, and if so, execute an
Unload me to remove the form.
As for disabling printing, saving, and so on - that's a bit more complicated. You can disable the menu items and toolbar icons associated with these choices in your Workbook_Open event handler, and re-enable them just before unloading the form. The close event you can handle through a workbook_beforeclose event, where you can set cancel to true if the user is not allowed to leave (not always good form to do that, though). To keep track of when it is OK to close, you could use a public variable that gets changed when all actions are complete. Rob
Actually, my advice wasn't all good. Just like you'd use the workbook_beforeclose event to handle premature closure, you should also use the beforeprint and beforesave events. They represent a cleaner way of accomplishing your goal, without side effects on other workbooks that the user may have open. Rob
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.