DEV Community

loading...

Discussion on: How to diff Excel VBA code in SourceTree (Git client)

Collapse
charlesrhall profile image
Charles Hall

I am a newbie when it comes to git and sourcetree, but with patience I was able to get my first vba diff to work

Then I discovered that the line numbers I use for error handling makes the diff useless. Every line of my vba code has a prefixed line number so when an error happens I get an error message than indicates which line of code errored out.

However, every so often I need to regenerate the line numbers if I have added more than a few lines of code to a module - however the git diff shows all the lines has having changed, not just the lines that I added.

Any idea how I could limit the diffs to only show changes to the code, not the prefixed line numbers?

Thanks in advance

Collapse
fzumstein profile image
Felix Zumstein Author

How are you prefixing line numbers?

Collapse
charlesrhall profile image
Charles Hall

It is a capability/feature in the VBA/VB development environments - one can add line numbers to each line of code, and then add the line number to any error message so that one knows which line of code was being executed when the error occurred.

Thread Thread
charlesrhall profile image
Charles Hall

It just occurred to me that the above is not accurate - the prefixing line numbers is part of a developer's addin called MZ-TOOLS - which I have used forever (hence why I thought it was part of the IDE)

Thread Thread
Sloan, the sloth mascot
Comment deleted
charlesrhall profile image
Charles Hall

I don't think I have explained myself - although the addin creates the numbers, the standard VBA interpreter uses them when an error occurs - without embedded line numbers, the error handling can not tell where the error occurred in a subroutine or function. So they are critical to providing support after the application is released.

Thread Thread
fzumstein profile image
Felix Zumstein Author

Hey just understood now what's going on. Yes, MZ-Tools adds the line numbers as part of the code, so there's nothing really that we can do about that. Except ask Microsoft to add line numbers to the VBA editor ;)