How to "Copy and Paste" a VBA form?

Asked

Viewed 5,086 times

4

I have a form ready that I want to take advantage of everything I did for him but in another form, it would be the case to do something similar to "Copy and Paste", has how to do?

1 answer

2


There’s a way I’ve found to do, to test create a form and put a button on it only to check the copy later.

To "copy", first, in the Project Explorer right-click on the name of the form you want to copy, then select "Export file...", and save with the same name in a folder (e.e.: Userform1).

Then open the form you want to copy and call the Estates, changing its name using Property "Name" (e.g.: change to Userform2).

To "paste up", back to use the right mouse button and use the option "Import file...", select the same file you saved and confirm (in this example, the Userform1).

Okay, see that both are present and both with the same button as it was in the original form. It’s a way to do the "copy and paste" for a form on VBA.

Watch out for change the Caption of the new form, because in fact it is not new, since only its name has been changed, the rest will remain the same (in this example, the Caption of Userform2 will continue with "Userfomr1"). That is it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.