Connecting to PlanMaker

<< Click to Display Table of Contents >>

Connecting to PlanMaker

In order to control PlanMaker from BasicMaker, you first need to connect to PlanMaker via OLE Automation. For this, first declare a variable of type Object, then assign to it the object "PlanMaker.Application" through use of the CreateObject function.

Dim pm as Object

Set pm = CreateObject("PlanMaker.Application")

If PlanMaker is already running, this function simply connects to PlanMaker; if not, then PlanMaker will be started beforehand.

The object variable "pm" now contains a reference to PlanMaker.

Important: Making PlanMaker visible

Please note: If you start PlanMaker in the way just described, its application window will be invisible by default. In order to make it visible, you must set the property Visible to True. The complete chain of commands should therefore be as follows:

Dim pm as Object

Set pm = CreateObject("PlanMaker.Application")

pm.Application.Visible = True

The "Application" object

The fundamental object that PlanMaker exposes for programming is Application. All other objects – such as collections of open documents and windows – are attached to the Application object.

The Application object contains not only its own properties (such as Application.Left for the x coordinate of the application window) and methods (such as Application.Quit for exiting from PlanMaker), but also contains pointers to other objects, for example Application.Options, that in turn have their own properties and methods and pointers to collections such as Workbooks (the collection of all currently open documents).

Notations

As mentioned in the previous section, you need to use dot notation as usual with OLE Automation to access the provided properties, methods, etc.

For example, Application.Left lets you address the Left property of the Application object. Application.Documents.Add references the Add method of the Documents collection which in turn is a member of Application.