One of the key features of some famous commercial software (such as Microsoft Office, AutoCAD 2002 etc.) is Microsoft Visual Basic for Application (VBA) integrated. Based on VBA, such kind of software become development platforms we know well. In this article, I would introduce to you how to create software integrated with Microsoft VBA and how to use components coming from ActiveX controls, COM, Visual C++, .NET and Delphi/C++ Builder etc. to compose complex interface layout in your ways in such software, and how to map each object to a VBA object.
How to create a program integrated with Microsoft VBA?
- You need to install Tangram SDK (You can get it free from here).
- After installing, you can use wizard to create a MFC project.
- Select wizard “Tangram Application 2”.
- Select all options in Tangram option pane of the next page.
- Compile and Run this program.
How to use this program to design a frame window?
Create a new document. You will see the word "DESIGN" in the new document. Click it, fill 1 in row, and 2 in columns in the splitter tab pane and create it. Repeat the operation above in the right splitter tab pane, fill 2 in rows and 1 in columns. Then you will see the figure below.
The figure below is a frame window having included different components created by different languages.
The left splitter pane is a MFC View. You can add a class using wizard "Tangram Component" to create it. On the top of the right splitter pane is a C# component, you can use "Tangram Windows ControlLib" to create a C# project. And on the bottom of the right splitter pane is a VB document DLL. It is very easy to connect it to this program. Fill project name into the "Com Wnd" tab pane, and click "Create COM Window" button, then you will see the figure like above.
Interface each other by VBA engine
You can find VBA from option "Tools" in the menu bar. Each component can be mapped to a VBA Project Object (VBA Project Item and VBA Host Control). And each object in this application interfaces each other via the VBA engine.
How to create a control bar?
Find option "Tool" in the menu bar of this application, and open VBA interface, you will see the Designer Tool Window as the figure below. Fill the name you want in the textbox "Caption", of combobox "Create Docking Control Bar", then click button "Create ControlBar".