The first thing one should address in an article about converting Office VBA applications to VB6 is “WHY?”
Why would someone bother in the year 2011 to convert one decade-old technology to another decade-old technology?
The answer is this: many businesses are still using these technologies. Especially large firms find it takes many years to switch to the latest and greatest.
Some of my clients still use Office 2003 or even Office 2000.
And I’m not talking only about small companies who perhaps don’t know any better or who are on tight budgets. I’m talking about large multinationals, the largest companies in the world.
The next question is: why convert from Office VBA to VB6?
- To create a free-standing application executable, one which doesn’t use a Word document or template directly to house the code. Granted, there are other ways to do this, but using VB6 may be one of the simplest.
- To take advantage of the speed advantage by using a compiled language like VB6 versus a semi-compiled/interpreted language like Office VBA.
- To have your code run in a more stable environment – VB6 versus Office VBA.
While we won’t go into a detailed technical how-to here, we will address the feasibility.
The answer is: yes, it is feasible to convert Office VBA applications to VB6 applications.
The language syntaxes are virtually identical.
Here are a few pointers:
- You must physically move the code. There are easy ways to do this.
- You must set proper References to the Office libraries that are usually set by default within the Office VBA environment.
- You must account for the differences between the Application object in Office VBA and the App object in VB6. They have little in common.
- Generally, you may find it best to use full object qualification in your code. For example, I routinely use Word.Document as an object type in my Word VBA code rather than simply Document. This does tend to make things a bit easier when converting to VB6. If you do this, you can be sure you’re referring to the correct object type. The same object type may exist in different libraries. I also use Word.Application rather than simply Application.
- With a bit of diligence and a cool head, you can successfully convert your Office VBA applications to VB6 applications.
Please feel free to contact us here at Soundside more information. And happy coding!