3

I encountered a question today tagged vba / vb6. Sometimes the two can coincide when the question is about the very basic language synax. But more often an issue is about either the one, or the other.

Initialize integer value while declaration vb6

In comments a discussion came up about which tag was meant - all too often we get VB6 questions in the VBA tag list that have nothing to do with VBA. A site member commented that VB6 is part of VBA, that this stands in the "info", meaning the VBA tag info:

VBA 6, was shipped in 1998 and includes a myriad of licensed hosts, among them: Office 2000 - 2010, AutoCAD, PI Processbook, and the stand-alone Visual Basic 6.0.

I've been working in the Office developer area for 25 years. I experienced the introduction of VBA. In my opinion, the above statement is incorrect. VBA derives from classic VB, which by the way did not start with VB6!

VB 1.0 was introduced in 1991 (ref https://en.m.wikibooks.org/wiki/Visual_Basic/History).

As I've always understood it, VBA is a subset of classic VB. I think the tag-wiki needs to be changed, but am hesitant to suggest this change without first checking here...

4
  • 2
    The primarily role of a [tag] is to draw attention of an expert, not to pigeon-hole a question. Somebody that still knows VB6 is likely to know the syntax constraints in VBA and the other way around, the flavors had a lot in common. The top-voted answer brings that point home pretty well, the poster only ever answered one [vb6] question before. That a commenter is a bit confused about history is not very relevant, keep in mind that it is not that useful to get into a debate about it. You can flag it "not constructive". Mar 13, 2016 at 10:44
  • @HansPassant. My main concern is reducing the amount of incorrect tagging. I have no idea, of course, how many people read that information and choose the VBA tag instead of VB6. Probably not too many read it, but I've fielded enough incorrect tags over the last week that I'd rather make the effort than not :-) That conversation in Comments is simply what made me aware of the discrepancy in tag-wiki - the discussion in that thread was over for me as soon as I figured out what the "info"... Mar 13, 2016 at 20:49
  • 1
    Hmya, tagging works completely different from the MSDN Forums. Which their chronic "You posted to the wrong forum!" posts and the busywork to move stuff around. If the OP had tagged it only [vb6] then it is pretty unlikely he would have gotten that helpful answer. It just doesn't have to be razor-sharp accurate, we expect users to use more than one tag. Mar 16, 2016 at 18:20
  • As I wrote in my Q, sometimes both are valid. Too often, however, it's a VB6 issue that has no relationship to anything in VBA. Different forms, different APIs for working with Windows, compiling, distributing, etc. There are also those who can't distinguish VBA and VB.NET, just FYI... Mar 16, 2016 at 19:13

1 Answer 1

6

You are right. The VBA tag wiki is completely wrong. Visual Basic 6 is not a "subset" of VBA.

The actual history is somewhat complicated. As the Wikipedia page says, the Visual Basic programming language grew out of a prototype designed by Alan Cooper. He contracted with Microsoft to turn this into a drag-and-drop GUI editor called Ruby. Microsoft added the BASIC programming language to make it a full development environment, which became known as Visual Basic. It was just the next iteration of Microsoft's wildly successful line of Basic products.

Visual Basic for Applications (as the name itself suggests) is a derivative of Visual Basic, designed for applications programming. In particular, Microsoft Office, but also used by other third-party products. That portion of the quoted sentence is true. The word "derivative" might also be kind of misleading in the sense that VB and VBA actually shared the same platform and runtime environment. However, the VBA toolchain is stripped of its ability to compile code into an executable binary. VBA is always dependent on the host (e.g., Microsoft Office and a document) for execution. Similarly, VBA cannot create DLLs, whereas VB can. VBA is also missing libraries that are included with VB, such as the global Printers, Screen, App, and Clipboard objects. If I remember correctly, the controls included with VBA are also different, because unlike VB, they are not simply wrappers around native Win32 windows but a proprietary implementation. So although they share the same syntax, it is far more accurate to say that VBA is a derivative/adaptation/subset/crippled version of VB. It is the little brother of VB, designed as a macro scripting language "for applications". The name gives it all away.

Wikipedia is also consistent with my recollection (gleaned not so much from my having personally being around to witness the history being made, but having read extensively about it, both in books and online over the years). But there is no need to trust Wikipedia or my own recollection. It just so happens that some dude named Joel Spolsky, who might know a thing or two about VBA, mused about its history several times on his blog. In this article, he describes the evolution of Excel's scripting language, from a rudimentary macro system to the adaptation of the existing Visual Basic product:

The first few versions of Excel (1.0 through 4.0) had a rudimentary macro programming capability using a programming language so embarassing that it never had a name, although it was sometimes called XLM (its file extension).

In 1991, Visual Basic 1.0 had just shipped to rave reviews. Combining a graphical UI builder similar to NeXTSTEP's Interface Builder with a simple Basic programming language that was highly compatible with QuickBasic, it rapidly became the best selling programming language, a position it maintained until droves of developers switched to web development.

Much as professional programmers sneer at the Basic programming language, market research unambiguously showed that about 2/3rds of the kinds of accidental programmers who develop macros preferred Basic to other languages and perceived it to be easy.

Thus, the obvious choice for Excel's next macro language was some version of Visual Basic.

There were a bunch of complicated requirements, though. Excel was cross platform. The Mac version sold very well. To be a good Mac player, Microsoft had to support Apple's cross-application scripting architecture, Apple Events. Rather than implement two object models, the Excel team concluded that the object model for Excel had to be Apple Events compatible. For complicated reasons, the Visual Basic engine wasn't object oriented "enough." In particular, objects could have properties, but those properties couldn't, themselves, be objects. Visual Basic 1.0 didn't support things like "rows(1).cells(2).value" because the row object couldn't contain another object.

The VB team implemented an all-new version, for both Macintosh (System 7 on Motorola 68k) and Windows (3.0 on 16 bit processors). This became Visual Basic for Applications, and, soon thereafter, the standalone version, Visual Basic 4.0.

The only complicated part is that VB was killed off by Microsoft completely in 2008 (when extended support ended) and effectively no longer exists. It had been replaced with VB.NET, which has very little aside from syntax in common with the legacy COM-based VB (the latest and greatest version of which was VB 6). The reason this introduces complication is that VBA does still exist and is still being developed. Microsoft Office 2010 introduced VBA 7, which adds new types and new features, including 64-bit support. It uses a different runtime DLL. VBA is now maintained by the Office team and, as far as I know, no longer available for distribution licensing to third parties. This has taken it in a different direction than classic VB. Now, they are arguably different languages, albeit with a shared history.

Indeed, the tag wiki needs to be updated. The sentence you quoted was introduced in the original revision by Ben McCormack. Apparently no one has dared question it since. Who knows now if it was a typo or he was just mistaken. Curiously, in his second revision, submitted a couple of days later, Ben added links to the very same articles on Joel's blog. It is very likely he read them. Several months later he went to work for Fog Creek Software. Either way, I don't think he'll be offended if you fix this mistake.

That's the whole reason why tag wikis are collaboratively edited. If you see a mistake like this in the future, and are certain that your knowledge is correct, don't second-guess yourself. Submit the edit; make the Internet a better place!

1
  • Our outlook on the topic coincides - thank you :-) Just wanted to be sure I hadn't missed something and start an "editing war" or something! Mar 13, 2016 at 20:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .