I am trying to refactor my VBA code. I am so used to using refactoring in Java-based IDEs for a number of years. Does VBA editor support any refactoring or are there any add-ins? MZ Tools did not have any such functionality.
I want to be able to do at least the following: 1. Rename variables 2. Split Procedures into sub-procedures to make the code more readable 3. Change the scope of the variable from global to procedure and vice-versa
Refactoring is the process of modifying programs to improve program structure without changing functionality.
Visual Studio Code supports refactoring operations (refactorings) such as Extract Method and Extract Variable to improve your code base from within your editor.
Refactoring may lessen performance, but the change may be negligible. You need to balance the change in the maintainability of the code vs. the change in its performance.
Disclaimer: I'm heavily involved with this project.
Rubberduck is an open-source add-in for the VBA/VB6 IDE under [very] active development, that includes this functionality.
Version 1.3 includes a Rename refactoring:
Version 2.0 (beta available, still stabilizing) includes a dozen refactorings:
Implement Interface creates stubs for all members of an unimplemented interface, so you don't need to create them manually by selecting them one by one in the code pane dropdown:
Implements IClass1 Public Sub IClass1_DoSomething() Err.Raise 5 'TODO implement interface member End Sub Public Function IClass1_GetFoo() As Integer Err.Raise 5 'TODO implement interface member End Function Sub DoSomething() End Sub Function GetFoo() As Integer End Function
More refactoring tools are on the project's roadmap (including Extract Method), which you can follow on GitHub.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With