rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.92k stars 302 forks source link

Add Support to Duplicate or Copy UserForm in Code Explorer #5821

Open vivekkpatel opened 3 years ago

vivekkpatel commented 3 years ago

What VBA Code Explorer Allows To Drag n Drop User Interface to Another Excel VBA Project. This process allow Us to duplicate UserForm which will save a lot of time. For example : https://jacksonjose.wordpress.com/2014/07/18/how-to-make-a-copy-of-a-userform-in-excel-vba/

retailcoder commented 3 years ago

You can already easily export all components of a VBA project to the file system (which works great for source control purposes) and import any component from a folder.

Is this a feature request specifically to add a "duplicate form" (or duplicate module?) command, or to add Code Explorer support for drag-and-drop to import components from the file system?

I would tend to opt for a more general-purpose solution than an over-specialized one, e.g. support a right-click drag-and-drop action that pops a small context menus with commands like "move here" and "copy here", and perhaps "copy designer data only" (which would copy the form but not its code-behind?) that take the @Folder annotations into account and could work with drag metadata from the Code Explorer, the VBE's own Project Explorer, or from Windows' File Explorer.

That said, it's arguable that needing to copy an entire form to make it work with different data implies very strong coupling between the UI and the application/business logic: there should be a way to reuse a user interface without needing to actually copy anything. From that perspective offering such a command could easily be turned into a great way to shoot oneself in the foot by facilitating a workflow that isn't necessarily sane from a software development point of view.

All in all, this probably isn't a functionality I would personally make use of, but I can see the perceived value of being able to easily copy/duplicate project components, and copy/paste is basic primordial functionality after all, and Visual Studio's Solution Explorer has it, with Ctrl+C/Ctrl+V support even - so I'm basically a bit reluctant because of the potential for abuse, but not necessarily against it, and it's something that would definitely be in-scope for Rubberduck.

vivekkpatel commented 3 years ago

You can already easily export all components of a VBA project to the file system (which works great for source control purposes) and import any component from a folder.

Yes, I've done same thing at End. I Use VBA Forms on regular basis so I was just looking for Simpler solution I am spoiled by visual studio Solution Explorer😅. If Someone One Can add functionality to right click and Copy Module/Class/Form then it will be great improvement to my vba workflow.