How to "Copy and Paste" a form in VBA?

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", how can I do it?     

asked by anonymous 15.05.2016 / 23:16

1 answer

2

There is a way I found it to do, to test create a form and put a button on it just to check the copy later.

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

Then open the form you want to copy and call Properties , changing its name using the Name property (eg change to UserForm2 ).

To "paste" , right-click again and use " Import file ... ", select the same file you saved and confirm (in this example, the UserForm1 ).

Done, see that both are present and both with the same button of the form that was in the original form. It's a way to " copy and paste " to a form in VBA .

Attempt to change the Caption of the new form, since it is not really new, since only its name has been changed, the rest will remain the same (in this example, Caption UserForm2 will continue with " UserFomr1 "). It is.

    
15.05.2016 / 23:28