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

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}\(

ELB Solutions.com Inc.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.