Creating a Document Management System in Word
Deleting an Existing Form
There also might come a time when you no longer need one of your forms. The steps to delete
a form, even though easy, involves a little twist. The steps are described below:
- Open the template file that contains the UserFormDMS.
- Press ALT+F11 to enter the VBE Window
- Open the "Forms" project up until you see the UserFormDMS form, then double-click on it
- Make note of the "OptButtonx" button number you are about to delete. For example, if you have 50 template forms and are deleting OptButton15, remember the 15. You will need to use it later.
- Select the button and press "Delete".
- Go to the TAB with the last button you created (OptButton50) and select it.
- Change its Name property to "OptButton15".
- Double-click the "OKAY" button and change the "50" in "For x = 1 to 50" to "49".
- Close the VBE window, save your template, and close it.
The reason for this additional change is that the code iterates through all "OptButtonx"
objects between the starting and ending number to find the one that is set to "True" so it can
go and open the form with the same name as the Caption. If an optionbutton is missing, the
code will fail. The actual number of each button is not important, just the fact that they
are sequential and the total number of buttons is the same as the number in the "For x = 1
to …" line of code.
Download the White Paper (Opens PDF version of WhitePaper in new window)