Link to home
Create AccountLog in
Avatar of Robert Berke
Robert BerkeFlag for United States of America

asked on

How make a VBA editing tool similar to Martin Liss' AnnotateVBA.DLL?

This is mainly for Martin Liss but other experts might be able to answer it.


Martin's AnnotateVBA is really cool.
 
I like its ability to easily zap the vba code and I want something similar for a tool I have created.
 
Can anyone point me to documentation that  allows me to make a similar DLL tool?
 
In particular, I created a "Paste Special Code" (Psc) tool has a PscAddLines function.
 
Currently I cut a portion of a VBA module to the clipboard then call "PscAddLines", and the clipboard gets modified to add line numbers.
 
I then paste it back into the module.  
 
Using a tool like your Annotator would be a cleaner approach.  I would just select the code I want to change, then run PscAddLines and the code would change.


rberke@berkeleyai.com
 

Avatar of Martin Liss
Martin Liss
Flag of United States of America image

I'm glad you like it. The add-in was written in Visual Basic Classic (VB6). If you happen to have that around I can just give you the project file but if not I can still give you pieces of it and leave it up to you to convert them to VBA.
Hi,

Maybe you can contact the creator of Rubberduck VBA, he made a great add-in for the VBA IDE.
I think it was developper with .NET.
Avatar of Robert Berke

ASKER

Fabrice,  Rubberduck look like it would  be great for unit testing of a commercial product.   But at first glance it looks like overkill fo my needs.  I might give it a closer look sometime in the future.

Martin. I do not have vb6 and would prefer converting it to vba. Can you post it here or do you want to send it some other way.

By the way I love the "close other IDE Wndows" function.  I have one suggested improvement.   It would be nice if it collapsed all of the open projects.

I don't personally need this Annotator improvement, because I already have my own version. But it is a nice improvement which others might enjoy.  

My version works like yours except mine calls CollapseVBIDETree which I found at   http://stackoverflow.com/questions/16977441/vbe-how-to-collapse-worksheets-by-default.

User generated image


Martin. I do not have vb6 and would prefer converting it to vba.
I just learned that you can't use VBA to make DLLs but you can use C++ or VB.Net to do it in Visual Studio.

I would be happy to post the code and the form modules if you'd like.
I just learned that you can't use VBA to make DLLs but you can use C++ or VB.Net to do it in Visual Studio.
Ehence why I suggest to contact Rubberduck developper, since his add-in (in fact, a COM component) is made with .Net technology, he might be able to point you to the right direction.
Martin,  go ahead and post them, but I don't know if I will use them.

10 years ago I dipped my toes into the .NET pool and liked what I saw.  But my main client was not interested, and I could never justify jumping all the way into the pool.

I am retired now, and have some time on my hands, so maybe I will revisit .NET.

Nonetheless converting an old vb6 app to .NET does not sound like an ideal starting point.

And trying to get RubberDuck developers to help me support my vague goals for a reasonable fee will be an exercise in futility.  

So maybe I should just install vb6? It is 22 years old and totally unsupported but maybe it will work.

Do either of you have any last opinions before I close this question?
Depending on your OS, you could have problems using VB6.
I have windows 10. I see that microsoft is committed to support vb6 runtime on windows 10 and 11.
So why would I have a problem?

11/28/2021 edit
Thanks to Fabrice and Martin I am confident that I can install VB6 on Windows 10.
But it is complicated enough that I will wait until I get my new xmas computer next month.



Problems can raise when installing development tools.
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
In July of 2022 Martin asked if I had made ;progress on my original question.

Answer:

No, I gave up on creating a VBE addin to modify code inside of the Editor window.

I continue to use  Cut and Paste to implement my "CodeFixer" programs.  For instance
1) cut a whole module
2) call "CodeFix_AddLineNumbers"
3) paste the new code on top of the old module.

 Martin's Annotator approach would have been cleaner, but it was beyond my current  capablities.

.