DEV Community

Discussion on: Excel'ing at PHP

gskur profile image

There is no such thing as "VBA hell" but simply a state of usual frustration trying to deal with a language one really does not know :) -- and, of course, the author doesn't (it's just a statement of fact, not a criticism).

It is not quite true that "VBA is from a different time." Rather, it was born in a different time but morphed/expanded/adjusted enough to remain quite viable even now. It was designed for MS Office apps and has been updated along the way so that even today one can do pretty much anything needed in that area, and very effectively too. And, btw, VBA versions for Excel, Access, Word, PowerPoint, etc. are different except for the core syntax and functionality. The only grudge I have is the VBE (the editor) which is certainly from 1980s, and not the best one even of those…

To illustrate the "not knowing the language" claim, here is a replacement for the “Public Function Malloc(ByVal size As Long) As String”. It is a simple “in-place” statement: Space(size). If you want zeros then this will do just fine: Replace(Space(size), " ", 0).

Or, regarding bit shifting: if you use Excel VBA you can utilize "WorkshitFunction" route to directly use the Excel's BITRSHIFT, BITLSHIFT, BITAND, BITOR and BITXOR functions.


Otherwise, it is a nice (and brave) article. Thanks.