Using PlanMaker’s methods

<< Click to Display Table of Contents >>

Using PlanMaker’s methods

In addition to properties, there are methods, and they implement commands that direct PlanMaker to execute a specific action.

For example, Application.Quit instructs PlanMaker to stop running and Application.Activate lets you force PlanMaker to bring its application window to the foreground, if it's covered by windows from other applications:

pm.Application.Activate

Function methods and procedure methods

There are two types of methods: those that return a value to the BASIC program and those that do not. The former are called (in the style of other programming languages) "function methods" or simply "functions", the latter "procedure methods" or simply "procedures".

This distinction may sound a bit picky to you, but it is not because it effects on the notation of instructions.

As long as you call a method without parameters, there is no syntactical difference:

Call as procedure:

pm.Workbooks.Add ' Add a document to the collection of open documents

Call as function:

Dim newDoc as Object

Set newDoc = pm.Workbooks.Add ' The same (returning an object this time)

As soon as you access methods with parameters, you need to employ two different styles:

Call as procedure:

pm.Application.RecentFiles.Add "Test.pmdx"

Call as function:

Dim x as Object

Set x = pm.Application.RecentFiles.Add("Test.pmdx") ' now with a return value

As you can see, if you call the method as a procedure, you may not surround the parameters with parentheses. If you call it as a function, you must surround them with parentheses.