Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use document while form is still showing 1

Status
Not open for further replies.

SgtPepps

IS-IT--Management
May 1, 2002
109
GB
I'd like to have a form showing on the screen while a document is being used, is this possible?
 
Yes, it's almost certainly possible.
Tell us more about what you're trying to accomplish.
Rob
[flowerface]
 
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.

Regards

Mike
 
Also, the user can't be allowed to Save, Print, close the document or stop the code whilst the form is showing But still be able modify the document.
 
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
[flowerface]
 
Cheers, you've given me plenty to think about.

Regards

Mike
 
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
[flowerface]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top