Good suggestion!
Did a quick test for this and could work.

However how can I get it in some sort of a variable?

At the end of the VBA code it should check this variable and if there are error it should generate a different text in the msgbox than when there are no errors.