The Application Evaluate Application ConvertFormula and Application ExecuteExcel Macro Functions

These functions all play by the rules, in that you must use U.S.-formatted strings. They do not, however, have local equivalents. To evaluate a formula that the user may have typed into a UserForm (or convert it from using relative to absolute cell ranges), you need to convert it to U.S. format before passing it to Application.Evaluate or Application.ConvertFormula.

The Application.ExecuteExcel4Macro function is used to execute XLM-style functions. One of the most common uses of it is to call the XLM PAGE.SETUP function, which is much faster than the VBA equivalent. This takes many parameters, including strings, numbers, and Booleans. Be very careful to explicitly convert all these parameters to U.S.-formatted strings, and avoid the temptation to shorten the code by omitting the Str around each one.

0 0

Post a comment