How to Close Excel Form in VBA

Excel, Word and PowerPoint Tutorials from Howtech
Excel, Word and PowerPoint Tutorials from Howtech
28.2 هزار بار بازدید - 11 سال پیش - In this tutorial we will
In this tutorial we will work on excel forms and VBA and we will learn how to use excel vba to close form.

Microsoft Excel is not only a spreadsheet application, it has far more functionality. One of those is the ability to work with Visual Basic to create interactivity.

Follow this step by step east tutorial to learn how to close Excel form in VBA by using unloadme function.

Step # 1 -- Button setup

This is a particularly easy task as it involves writing a small statement. But before that, we must have a button created on that form.

For inserting a button, we have to go to "Insert" Menu and click "User Form".

After that we can Use the toolbox to drag and drop a button.

Let's name the button as "Save and close".

Step # 2 -- Unloading myself

Once the prerequisite is complete we will now tell the form to close on the press of the button. To do this we will double click on the button. This opens a new window with a sub routine already created for the button click event. Here we will write a small statement, the Unload Me command.

Since the form is supposed to close itself, it will use the Me keyword present in Visual Basic, otherwise the name of the form would have been written in its place.

And this was all about how we can use excel vba to close form.
11 سال پیش در تاریخ 1392/02/06 منتشر شده است.
28,209 بـار بازدید شده
... بیشتر