Regex for VBA’s annoying habit of not knowing where itself is

VBA has an annoying habit of not knowing where “V.B.A.” is located – and, for example, on SOME machines – it can’t find the reference to common functions like “Left()”. Seriously!?. So adding VBA. as a prefix helps that. What is really going on is on some people’s computer it is looking for the office library first and then the VBA library and other computers do it in the reverse order. For example – it will say variable = Left(othervar,1) is illegal but if you put VBA.Left(othervar,1) . Other examples are Environ$( or Left$(, Mid, Right, Asc, Hex, Chr . It is annoying and it only shows up when other computers go to use it. Here is a regex that helps find them all.

(?<!VBA\.)(Envrion|Chr|Asc|Mid|Right|Hex|Left)[\$]{0,1}\(