Basic en
Basic en
BasicMaker
Welcome! 9
What is BasicMaker? ..................................................................................................................... 10
Appendix 399
Ribbon commands and corresponding menu commands ............................................................. 399
Color constants ............................................................................................................................. 403
Color constants for BGR colors ............................................................................................. 403
Color constants for index colors ............................................................................................ 404
Command-line parameters ........................................................................................................... 406
Index 408
Welcome! 9
Welcome!
Welcome to BasicMaker!
This manual describes how to use BasicMaker, a programming environment that allows you to control
TextMaker, PlanMaker and other VBA-compatible Windows programs using scripts.
BasicMaker is only available for Windows and is not included in all versions of SoftMaker Office.
Note: This manual was written in order to describe how to use the program via the new ribbon user
interface. A description of its use via classic menus with toolbars can only be found in older manuals.
Tip: A table in the appendix shows you which ribbon command corresponds to which menu command:
Ribbon commands and corresponding menu commands
What is BasicMaker?
BasicMaker is an easy to use development environment for the programming language SoftMaker Basic.
Note: BasicMaker is only available for Windows and is not included in all versions of SoftMaker Office.
Starting BasicMaker
To start BasicMaker, do any of the following:
§ Starting BasicMaker from the Start menu
To start BasicMaker, use the Start menu (the icon with the Windows logo) in the lower left corner of the
screen. You will find your SoftMaker Office applications in a folder called SoftMaker Office.
BasicMaker's script editor will open. It can be used for creating and editing scripts as well as running
scripts. For details on each of its menu commands, see the sections that follow.
§ File | New
Creates a new script.
§ File | Open
Opens an existing script.
You can also open VBA scripts (VBA = Visual Basic for Applications), however, not all VBA commands
are supported by BasicMaker.
§ File | Close
Closes the current window.
§ File | Save
Saves the script in the current window.
§ File | Save as
Saves the script in the current window under another name and/or in another folder.
§ File | Print
Prints the script in the current window.
§ File | Versions
Returns to a previous version of the currently open script. For more information, see section Changing the
settings of the script editor, "Backup tab".
Using the script editor 13
§ File | Options
Lets you control the settings of the editor. Read more about this in the section Changing the settings of the
script editor.
§ File | Customize
Lets you customize the ribbons (or the toolbars) as well as the shortcut keys for the editor. For detailed
information, refer to the TextMaker manual – under the following keywords: "Customizing the ribbon" (or "
Customizing toolbars") and "Customizing shortcut keys".
To execute a command, select a file from the list and then click on one of the buttons.
The buttons in the file manager have the following functions:
Open
Clicking this button will open the selected file.
Using the script editor 14
Close
Clicking this button will close the file manager.
Search
Click this button to search for a certain file or to choose the folder for the file manager to display.
A dialog box with the following functions appears:
§ File name
Allows you to specify a unique filename or a filename pattern as the search target.
With the default setting *.bas, the search function will find all Basic scripts.
If you specify a unique filename like listfonts.bas, only files with exactly this name will be found.
If you specify a filename pattern like list*.bas, all scripts whose filenames begin with "List" will be
found.
§ File type
From this list, you can choose the type of the files to be targeted in the search.
§ Folders
Here you can select the drive and folder in which the file manager is to carry out the search.
§ Include subfolders
If this option is enabled, the file manager searches not only the selected folder, but also all folders below the
selected folder.
§ "New list" button
Starts a new search with the current settings.
§ "Add to list" button
Also starts a new search; however, any previous search results remain in the list rather than being cleared
from the list. The new search results will be added to the old ones.
§ "Quick paths" button
Quick paths allow you to create shortcuts to the folders that you use most often, so that they can easily be
accessed in file dialogs. For details, see the TextMaker or PlanMaker manual, keyword "Quick paths".
Print
If you click this button, you can print the selected file.
Delete
If you click this button, the selected file will be deleted (after confirmation).
Using the script editor 15
Rename
If you click this button, the selected file will be renamed.
§ Dialog
Opens the graphical dialog editor, with which you can create and edit user-defined dialog boxes. For more
information, see the section Using the dialog editor.
§ Bookmark
Sets a bookmark at the current position. This can be visited again at any time with the ribbon command
Home | Go to. More on this can be found in the section Bookmarks and the Go to command.
§ SmartText
Allows you to insert and edit SmartText entries. For more information, see the section Using SmartText.
Tipp: Using SmartText entries for frequently used instructions or routines can save you a lot of time!
§ Document
Inserts another script or text document at the current position of the cursor. A file dialog appears where you
can choose the desired document.
§ Special characters
Opens a window containing all the different symbols and other special characters that you can insert in the
text. Select the desired character and click the Insert button.
§ Replace
Lets you search for text and replace it with some other text. More information about this can be found in the
section Searching and replacing in the script editor.
§ Find next
Repeats the last search or replace command. More information about this can be found in the section
Searching and replacing in the script editor.
§ Go to
Lets you set and navigate to bookmarks in the script. More on this can be found in the section Bookmarks
and the Go to command.
Search
With the ribbon command Home | Search, you can search for text. Type in the term you want to search and
click the Search button.
Options available in the Search dialog box:
Case-sensitive: If this option is checked, the case of the letters in the found text must be the same as the search
term. Thus, if you search for "Print", only "Print would be found and not "print" or "PRINT".
Whole words only: If checked, only those occurrences of the search term that are separate words (not just part
of a word) will be found.
Search from top: If checked, the search starts at the top of the script instead of the current position of the text
cursor.
Search Backwards: If checked, the search is conducted from the position of the text cursor backwards to the
top of the script, otherwise forwards.
Reset: Use this button to remove the search text entered in the dialog box.
Replace
With the ribbon command Home | Replace, you can search for text and replace it with different text. Enter the
search string and the replacement string.
Options: see above
Using the script editor 18
Start the search with the Search button. When the script editor finds the searched text, it scrolls to its position
in the document and selects it.
You can then do any of the following:
A. You can click on Replace to have the editor replace the selected occurrence of the search term with the
replacement term and jump to the next occurrence of the search term.
B. You can click on Search again to have the editor jump to the next occurrence of the search term – without
replacing the selected occurrence.
C. You can click on Replace all to have the editor replace the selected occurrence of the search term and all
subsequent occurrences it finds in the text.
D. You can click on Close to end the search and close the search dialog box.
Search again
With the ribbon command Home | Search again, you can repeat the last search or replacement action.
Setting bookmarks
To set up a bookmark, do the following:
1. Move the cursor to the text position where you want to place the bookmark.
2. Select the ribbon command Home | Insert group | Bookmark.
3. Type in a name of your choosing for the bookmark. Its name may contain only letters, numbers and
underscores. Special characters are not allowed. The name must begin with a letter.
4. Click on OK to set the bookmark.
You can define an unlimited number of bookmarks.
Calling a bookmark
To return to a bookmarked position in the script, do the following:
1. Select the ribbon command Home | Search group | Go to.
2. Choose the desired bookmark from the list or type in its name.
Using the script editor 19
3. Click on OK.
The text cursor will now jump to the position where the bookmark was created.
Deleting bookmarks
When a bookmark is no longer needed, you can delete it using the following procedure:
1. Select the ribbon command Home | Insert group | Bookmark.
2. Select the bookmark you want to delete from the list, or enter its name manually.
3. Click on Delete.
Note: When you delete a passage of text containing a bookmark, the bookmark is deleted automatically.
Show bookmarks
Choose the ribbon command View | Bookmarks to enable or disable the display of bookmarks in the script
editor.
Using SmartText
Exactly like in the word processor TextMaker, you can setup SmartText entries in BasicMaker’s script editor.
This feature can save you a lot of typing: You can define entries for frequently needed names or source code
fragments and then call them up quickly and easily.
For example, you could create a SmartText entry named "tma" containing "tm.Application.ActiveDocument".
Later, just type "tma" in the script and press the space bar or a punctuation character. Immediately, "tma" will
be replaced with "tm.Application.ActiveDocument".
This can save you lot of time otherwise spent on typing.
The SmartText entry has now been created. Later, the SmartText entry can be called up by using the specified
name.
Note: If this does not work, you have disabled the option Expand SmartText entries. Select the ribbon
command File | Options, switch to the General tab and activate this option again.
Alternatively, you can insert the element using a dialog box with the ribbon command Home | SmartText,
selecting the desired element and then clicking the Insert button.
§ Deleting an entry
To delete a text module, select it from the Text modules list and click the Deletebutton.
§ Renaming an entry
To change the name of an entry, select it from the list, click on Rename and enter a new name.
§ Editing an entry
To edit an entry, select it from the list and then click in the large input field. Now you can modify the
content of the SmartText entry.
§ Inserting an entry
To insert a SmartText entry into the script, select it from the list and click on the Insert button.
§ View | Bookmarks
Allows you to choose whether Bookmarks are visible in the script.
§ View | Windows
The Close all command closes all open windows.
All open windows are listed in the window list below. If you click on an entry, the corresponding window
comes to the foreground.
§ Touch mode
If you enable this button, all symbols in the ribbon will be slightly larger. This is useful when operating the
software with your finger (for example, on a tablet).
§ Opening files
Opens an existing script, see Commands on the File ribbon tab.
§ Save file
Saves the script in the current window, see Commands on the File ribbon tab.
§ Undo
Undoes the last text change in the current script window. You can execute this command several times, in
order to undo the last x changes.
§ Redo
Restores the effect of your most recently Undo operations. This command can also be executed repeatedly.
Using the script editor 22
To the right of the quick access bar, there is a double arrow. With this button you can enable/disable and
configure the symbols of the script editor or change the position of the quick access bar. For detailed
information, refer to the TextMaker manual, keyword "Quick access toolbar".
To the left of the Quick access toolbar, you will find the "hamburger-menu" . Even if you have selected
the "ribbon" as the user interface (see Changing the settings of the script editor), the "hamburger menu" is still
available in the Quick access toolbar in case you would like to access the menu commands of the classic menu
interface.
View tab
Use this tab to change settings related to the appearance of the program:
§ Typeface and Size
Lets you choose the font face and size to be used in the editor. It is recommended to choose a non
proportional font like "Courier New".
§ Tabs
Lets you adjust the width of tabs (in characters). This determines by how many characters the text is
indented when the tab key is pressed.
§ Show bookmarks
Normally, bookmarks are not visible in the script. However, if you enable this option, bookmarks will be
displayed. For information about using bookmarks, see the Bookmarks section and the Go to command.
General tab
Use this tab to change general settings:
§ Maximum number of undo steps
Lets you specify the number of actions that can be reversed with the Undo command.
Appearance tab
Use this tab to customize the user interface of BasicMaker:
§ Dialog language
Here you can select the language to be used for the user interface (menus, dialog boxes, etc).
§ User interface
When you click on the User interface button, a dialog box appears in which you can select the type of user
interface that the applications in SoftMaker Office should use:
Ribbon (upper row): If you select one of the styles from the top row, the programs use a "ribbon" as the
user interface. The only difference between the individual styles is in the color scheme used.
Classic menus with toolbars (lower row): When you select one of the entries from the bottom row, the
programs will use classic menus with toolbars. You can also choose between different color schemes
here.
Tip: Alternatively, you can also enable/disable touch mode with the following commands:
Ribbon user interface: Here, you choose the command Touch mode in the Quick access toolbar.
Classic menu interface: Here, you choose the command View > Touch mode.
§ Show tooltips
This option lets you specify whether or not tooltips should be displayed. These are short info texts that are
displayed next to the mouse pointer when you point the mouse at a screen element.
§ Beep on errors
If this option is enabled, BasicMaker emits a beep for error or warning messages.
§ Workspace color
This option allows you to change the background color of document windows.
"Files" tab
Use this tab to change options regarding the opening of files.
§ Recently used files in File menu
BasicMaker displays a list of the files most recently opened in it in the File menu. If you select one of these
entries, the corresponding file will be opened immediately. Here, you can specify the number of files to be
displayed in the list.
"Backup" tab
Use this tab to change options regarding the manual and automatic saving of files:
§ When you save a file manually
Keep older versions of the document: Several generations of file backups are created for each script
when you save a script manually. All of these copies are stored in a special Backup folder.
Tip: If this option is enabled, the command File | Versions (in the group File management) is also
available, which allows you to easily return to a previous file version of the currently open script.
Number of versions to keep: Here, you specify the maximum number of versions of backups
(generations) to be kept per script.
§ "Cleanup" button: This button provides two options for deleting file backups:
Delete orphaned file versions removes all BasicMaker backups for which the corresponding original
document no longer exists.
Delete file versions of all documents removes all BasicMaker backups.
If the saving of backup copies has been activated, you can open the version manager with the File | Versions
command. All available backups of the currently open script are clearly listed here and you can return to a
previous file version.
More detailed information on the usage of backup copies can be found in the TextMaker manual, keyword
"Backup copies".
"Manage" button
In the dialog box of the ribbon command File | Options, you will find the Manage button on each tab. You can
use it to save the settings of the program and, for example, transfer them to a new version.
For more information, see the following pages.
Exporting/importing settings
You can save your individual settings that you have configured in the SoftMaker Office applications. In the first
step, export the settings data – for example, before you install a new version. Then, in the second step, import
this data into the newly installed version.
For both steps, use the Manage button in the dialog box of the command File | Options .
For information on which settings you can export/import exactly, see below.
Note: Export and import of settings data is only possible as of version 2021.
§ You want to apply the settings of an old version of SoftMaker Office to another computer on which you
have installed the new version of SoftMaker Office.
Note: This information is for illustrative purposes only and you usually do not need to do anything here.
BasicMaker will automatically replace these files for you if you perform the steps described below for
exporting/importing the settings.
Tip: You can also just export all of them, but you will have to ensure when subsequently importing that you
only select the options you really want.
§ Configuration files
This option saves all the settings you have made in the dialog box of the command File | Options. Some of
these settings are also located directly on the ribbon tabs (or in the toolbars).
§ Customized ribbon/toolbars
If you have changed the arrangement on the ribbon, in the Quick access toolbar or in toolbars, you can save
your individual arrangement with this option.
Please note for the import of the settings from an old to a new version of SoftMaker Office: If this option is enabled, command
icons that have been newly added in the more recent version will not be displayed there. Thus, if you would prefer the new icons to
be displayed instead of keeping your old arrangement, you should disable this option. Alternatively, you can import your old
arrangement anyway and look for the new symbols relevant to you afterwards using the command File | Customize.
§ Keyboard shortcuts
This option allows you to apply shortcut keys that you have assigned yourself.
§ User dictionaries
This option allows you to save the words that you have added to your user dictionaries (see TextMaker,
PlanMaker, Presentations).
Note: The settings of all SoftMaker Office applications are exported (TextMaker, PlanMaker, Presentations,
BasicMaker). The same applies to the import in the following step.
"Reset" button
The Reset button resets all program settings back to their delivery state.
Note: This action resets the settings for all SoftMaker Office applications (TextMaker, PlanMaker,
Presentations, BasicMaker) of this version.
Using the script editor 28
Starting scripts
Basic scripts can be started from BasicMaker, TextMaker or PlanMaker:
§ Starting from BasicMaker
To execute a script, select the ribbon command Home | Program group | Start in BasicMaker or press the
F9 key.
§ Starting from TextMaker or PlanMaker
You can also start a script from TextMaker or PlanMaker. To do this, select the ribbon command File |
Scripts group | Start script in TextMaker or PlanMaker. A file dialog will appear. Select a script, confirm
with OK and the script will be executed.
§ Starting from the command line
Alternatively, scripts can be started from the command line by entering BasicMaker /s scriptname.bas.
BasicMaker will start, run the specified script and then close.
Aborting a script
You can abort running scripts by pressing the key combination Ctrl+Break. (If another application is in the
foreground at this moment, switch to the BasicMaker application window first.)
Debugging scripts
The script editor offers commands that help you find and fix errors ("debugging"):
§ Running a script step by step
§ Using breakpoints
§ Watching variables
Using breakpoints
If you place a breakpoint in a line of your script and then run the script, execution will stop at this line.
To resume the execution afterwards, you can select the ribbon command Home | Program group | Start, or
alternatively Home | Trace or Home | Step.
Watching variables
Use the Watch window to view the content of variables during the execution of a script. This is especially
useful when running a script step by step.
In order to monitor a variable, do the following:
1. If the watch window is currently not visible, activate it by using the ribbon command View | Watch.
Using the script editor 30
2. In the script, click on the name of the variable that you want to monitor. Then right-click to open the context
menu and choose the command Show variable. You can also simply type in the name of the variable in an
empty row of the watch window.
3. Now start the script with the ribbon command Home | Program group | Start, or alternatively with Home |
Trace or Home | Step.
The content of the variable will be shown in the watch window and be constantly updated.
General information
In SoftMaker Basic, you can build dialog boxes in order to allow your scripts to interact with the user.
To create a dialog box, you must define a dialog. The dialog definition can either be entered manually in the
script (see the section Dialog definition) or you can use the dialog editor for this (see next section).
The dialog editor provides a graphical user interface for creating dialogs. You can insert dialogs controls using
the toolbar or the commands in the Insert menu of the dialog editor. Existing elements can be moved and
resized just like with a drawing program and their properties can be changed through the Edit menu.
Read more about it on the following pages.
Right: Aligns the elements to the right border of the rightmost element.
Space evenly: Spaces the elements evenly between the left border of the leftmost and the right border of
the rightmost element.
Centered in window: Centers the elements within the dialog box.
The settings in the Vertical section work accordingly.
§ Edit > Size
Changes the size of the currently selected dialog elements. Options available:
No change: No change is made.
Minimum width: The width is adapted to that of the narrowest selected item.
Maximum width: The width is adapted to that of the widest selected item.
Value: The width is set to a fixed value (entered in screen pixels).
The settings in the Height column work accordingly.
§ Edit > Grid
Here you can configure the grid. The grid is a positioning aid for dialog elements. When it is enabled,
elements cannot be shifted to arbitrary positions; instead they snap from one grid point to the next. Options
available:
Show grid: Determines if grid points should be displayed (in the dialog editor).
Snap to grid: Determines if the grid is activate.
X and Y increment: Determines the distance of the grid points.
Tip: To fit elements on the grid that have already been inserted, use the Edit > Snap to Grid menu
command.
OK button F2
Cancel button F3
Button F4
Using the script editor 34
Radio button F5
Check box F6
Text F7
Input box F8
Group box F9
Combo box
Drop-down list
First, choose which kind of dialog element you want to insert. Then, in the dialog box drag a frame with the
desired size and position.
Detailed information on each dialog element can be found in the section Controls of a dialog box.
Using the script editor 35
Language elements of SoftMaker Basic 36
Syntax fundamentals
Comments
Text that is preceded by the keyword Rem or an apostrophe (') will be seen as a comment and not executed.
You can use comments to annotate your scripts.
' This is a comment
rem This too
REM This too
Rem This too
As you can see, the Rem statement is not case-sensitive. This is the same with all keywords in SoftMaker
Basic.
Comments can also be placed at the end of a line:
MsgBox Msg ' Display message
Numbers
You can write numbers in three different ways: decimal, octal and hexadecimal:
§ Decimal numbers: Most of the examples in this manual employ decimal numbers (base 10).
§ Octal numbers: If you would like to use octal numbers (base 8), place &O in front of the number – for
example &O37.
§ Hexadecimal numbers: For hexadecimal numbers (base 16), use the prefix &H – for example &H1F.
Names
Variables, constants, subroutines and functions are addressed by their names. The following naming
conventions apply:
§ Only the letters A-Z and a-z, underscores (_) and the digits 0-9 are allowed.
§ Names are not case-sensitive.
§ The first letter of a name must always be a letter.
§ The length may not exceed 40 characters.
§ Keywords of SoftMaker Basic may not be used.
Language elements of SoftMaker Basic 38
Data types
The following data types are available:
Type Suffix Syntax of the declaration Size
x = x + 8
x = "F" & x
Print x ' Result: "F18"
End Sub
When numbers are stored in a variant variable, SoftMaker Basic automatically chooses the most compact data
type possible. As a result, numbers will be represented as one of the following (in this order): Integer, Long,
Single, Double.
The data type used by a variant variable can change at any time. You can use the VarType function to
determine the current data type. You can use the ***IsNumeric function to check whether the variable currently
contains a numeric value.
Variant variables can take two special values which are not available in other data types:
§ Empty is the value of a variant variable that has not yet been initialized. It can be queried with the IsEmpty
function. In numeric operations, Empty is interpreted as 0, in string operations as an empty string.
§ The value Null serves to signal the fact that no (valid) value is available. It can be queried with the function
IsNull. Each operation with a Null value results in Null.
Variables of this type can be created like other variables with Dim or Static. The individual elements can be
accessed with the point notation Variable.element (see also With statement).
Dim p As Person
p.LastName = "Smith"
Language elements of SoftMaker Basic 40
Variables
Declaring variables
Variables are created with the statements Dim or Static. By default, variables have the type Variant. If a
different data type is desired, you must specify it in the declaration with As Type or with a type suffix (e.g. %
for Integer) (see the section Data Types).
' Declare X as a variant variable:
Dim X
' Declare X as an integer variable:
Dim X As Integer
' Same as the statement above:
Dim X%
' Multiple declarations in a line:
Dim X%, Name$
Scope of variables
Variables can be either local or global:
§ Global variables are created with a Dim statement outside of a procedure. They can be accessed anywhere.
§ Local variables are created with a Dim or Static statement within a procedure (subroutine or function). They
are only available within the procedure.
Arrays
SoftMaker Basic supports one- and multi-dimensional arrays. In arrays, series of values can be stored under a
uniform name. Each value in the array can be accessed by an index.
All elements of an array have the same data type. The following data types are allowed: Integer, Long, Single,
Double or String.
Note: In some Basic variants, arrays can be used without previous declaration. In SoftMaker Basic, this is not
allowed. Arrays must be declared before their first use, using either Dim or Static.
To set the size of an array, you indicate the upper limit and optionally the lower limit for the index. Only fixed
values are allowed, variables are not acceptable.
If the lower limit is omitted, the value defined by Option Base is taken – by default, this is 0.
Dim a(10) As Integer ' a(0)..a(10)
Dim b(-10 To 10) As Double ' b(-10)..b(10)
Language elements of SoftMaker Basic 41
You can use loops to efficiently access the elements of arrays. For example, the following For loop initializes
all elements of the array "A" with 1:
Static A (1 To 20) As Integer
Dim i As Integer
For i = 1 To 20
A(i) = 1
Next i
Multi-dimensional arrays
Arrays can also have multiple dimensions, for example:
Static a(10, 10) As Double ' two-dimensional
Dim b(5, 3, 2) ' three-dimensional
Operators
SoftMaker Basic supports the following operators:
Arithmetic operators
Operator Function Example
+ Addition x=a+b
- Subtraction x=a-b
also: Negation x = -a
* Multiplication x=a*3
/ Division x=a/b
^ Exponentiation x=a^b
String operators
Operator Function Example
The difference between the operators + and & is in the handling of variant variables that contain numbers: the +
operator adds these numbers, whereas the & operator concatenates them as strings (see example).
Example:
Sub Main
Dim a, b as Variant ' 2 variant variables
a = 2
b = 3
Print a + b ' Return the number 5
Print a & b ' Returns the string "23"
End Sub
Comparison operators
Operator Function Example
These operators work bitwise. This means that you can use them for logic testing as well as for bitwise
operations.
Precedence of operators
Operators are processed in the following order:
Operator Function Precedence
Language elements of SoftMaker Basic 43
() Parentheses highest
^ Exponentiation
+- Positive/negative sign
/* Division/multiplication
+- Addition/subtraction
Mod Modulo
Or Logical Or lowest
Flow control
SoftMaker Basic provides a number of statements that control the program flow in scripts. For example, there
are statements that perform, skip or repeat statements depending on a condition. There are the following
variations:
Goto branches
Goto Label1
.
.
.
Label1:
The Goto statement performs an unconditional jump the specified label – in the above example to the label
"Label1".
Gosub branches
Gosub Label1
.
.
.
Label1:
Statement(s)...
Return
A jump target must also be specified for the Gosub statement. The difference to the Goto statementis that the
Gosub statement returns to the original program position as soon as it encounters a Return statement.
Language elements of SoftMaker Basic 44
Do loops
With a Do Loop loop, a group of statements can be executed multiple times. There are the following variations:
Do While | Until Condition
Statement(s)...
[Exit Do]
Statement(s)...
Loop
Or:
Do
Statement(s)...
Loop While | Until Condition
The difference:
Do While and Do Until check the condition before beginning to execute the statements inside the loop. These
will be executed only if the condition is true.
With Do ... Loop While and Do ... Loop Until, the condition is checked after the loop has been executed for
the first time. This means that the statements inside the loop are carried out at least once.
While loops
While ... Wend loops are identical to Do While ... Loop loops. The condition is also checked before the first
execution of the statements inside the loop.
While Condition
Statement(s)...
Wend
If branches
In an If Then block, statements are only executed if the specified condition is true. This condition must be an
expression whose result is True or False (for example If a<b Then).
An If ... Then block can contain one or more lines. If it extends over multiple lines, it must be ended with an
End If statement.
If Condition Then statement(s)... ' One-line syntax
Or:
Language elements of SoftMaker Basic 45
A variation of this are If ... Then ... Else statements. Here, the statements after Else are executed if the
condition is not true.
If Condition Then
Statement(s)...
Else
Statement(s)...
End If
Further branches can be achieved by chaining multiple If ... Then ... ElseIf statements together. However, this
may lead to code that is hard to understand and it is therefore recommended to use the Select Case statement
instead (see below).
If Condition Then
Statement(s)...
ElseIf Condition Then
Statement(s)...
Else
Statement(s)...
End If
If the variable contains, for example, the value "Value1", the statements after Case Value1 will be executed. If
it has none of the specified values, the code will jump to the statements after Case Else (if given; otherwise the
structure will simply be exited from).
§ Functions in DLLs can be declared with the Declare statement (see the section Calling functions in DLLs).
§ ByVal
With ByVal ("by value"), the procedure merely receives a copy of the variable, so that changes to the
parameter’s value inside the procedure do not affect the specified variable.
To pass a parameter by value, place the keyword ByVal in front of the parameter: Sub Joe(ByVal j As
Integer).
Alternatively, you can achieve this by passing the parameter in parentheses. Here, for example, the
parameter Var3 is passed by value:
SubOne Var1, Var2, (Var3)
Once the procedure has been declared, it can be used like any other BASIC function or statement.
Language elements of SoftMaker Basic 47
File operations
In SoftMaker Basic, you have access to all the usual file operations. Below is a small example. Further
information on the individual statements can be found in the chapter Statements and functions from A to Z.
Example:
Sub FileIO_Example
Dim i, Msg
Call Make3Files()
Msg = "Three test files have been created. "
Msg = Msg & "Press OK to delete them."
MsgBox Msg
For i = 1 To 3
Kill "TEST" & i ' Delete files
Next i
End Sub
Sub Make3Files
Dim i, FNum, Fname
For i = 1 To 3
FNum = FreeFile ' Get the next free file number
FName = "TEST" & FNum
Open FName For Output As FNum ' Open file
Print #i, "This is test #" & i ' Write to file
Print #i, "Here comes another "; "line"; i
Next i
Close ' Close all files
End Sub
Dialog boxes
You can define your own dialog boxes SoftMaker Basic and then invoke and evaluate them with the Dialog
function.
Dialogs can be created either by manually entering their contents in a dialog definition or through use of the
built-in dialog editor.
A dialog can optionally be connected to a Dialog function, which allows you to dynamically enable and disable
dialog controls and even makes it possible to create nested dialogs.
Dialog definition
To create a dialog box, you need to insert a dialog definition in the script. You can use either the built-in dialog
editor (see the section Using the dialog editor) or enter the dialog definition manually.
Language elements of SoftMaker Basic 48
DialogName Name of the dialog definition. After you have set up the dialog definition, you can declare a
variable of this type (Dim Name As DialogName).
X, Y Optional. Sets the screen coordinates for the upper left corner of the dialog box (in screen pixels).
Width, Height Sets the width and height of the dialog (in screen pixels).
Title$ The title of the dialog. It will be shown in the title bar of the dialog.
.DialogFunction The (optional) dialog function for this dialog. Allows you to dynamically enable and disable dialog
controls while the dialog is displayed and makes it possible to create nested dialogs (see the
section The dialog function).
Inside the dialog definition, you can define the dialog controls that you want to display. Use the keywords
covered on the next pages for this.
Example:
Sub Main
Begin Dialog QuitDialogTemplate 16, 32, 116, 64, "Quit?"
Text 4, 8, 108, 8, "Would you like to quit the program?"
CheckBox 32, 24, 63, 8, "Save changes", .SaveChanges
OKButton 12, 40, 40, 14
CancelButton 60, 40, 40, 14
End Dialog
Dim QuitDialog As QuitDialogTemplate
rc% = Dialog(QuitDialog)
' Here you can evaluate the result (rc%) of the dialog
End Sub
Command buttons
The OK and Cancel buttons are known as command buttons.
Note: Every dialog must contain at least one command button.
Syntax:
OKButton X, Y, Width, Height
CancelButton X, Y, Width, Height
Example:
Sub Main
Begin Dialog ButtonSample 16, 32, 180, 96, "OK and Cancel"
OKButton 132, 8, 40, 14
CancelButton 132, 28, 40, 14
End Dialog
Dim Dlg1 As ButtonSample
rc% = Dialog (Dlg1)
End Sub
Language elements of SoftMaker Basic 50
Syntax:
Text X, Y, Width, Height, Text
TextBox X, Y, Width, Height, .ID
ID is a variable that contains the current text.
Example:
Sub Main
Begin Dialog TextBoxSample 16, 30, 180, 96, "Text and input boxes"
OKButton 132, 20, 40, 14
CancelButton 132, 44, 40, 14
Text 8, 8, 32, 8, "Input field:"
TextBox 8, 20, 100, 12, .TextBox1
End Dialog
Dim Dlg1 As TextBoxSample
rc% = Dialog(Dlg1)
End Sub
Syntax:
ListBox X, Y, Width, Height, Content, .ID
ComboBox X, Y, Width, Height, Content, .ID
DropListBox X, Y, Width, Height, Content, .ID
The individual text entries are set through the string array Content which you need to fill before displaying the
dialog.
ID is a variable that contains the currently selected item: For ListBox and DropListBox this is a number (the
index), for ComboBox it is text.
Example:
Sub Main
Dim MyList$(5)
MyList(0) = "List Entry 1"
MyList(1) = "List Entry 2"
MyList(2) = "List Entry 3"
MyList(3) = "List Entry 4"
MyList(4) = "List Entry 5"
MyList(5) = "List Entry 6"
Begin Dialog BoxSample 16,35,256,89,"List box, combo box and drop-down list"
OKButton 204, 24, 40, 14
CancelButton 204, 44, 40, 14
ListBox 12, 24, 48, 40, MyList$(), .Lstbox
DropListBox 124, 24, 72, 40, MyList$(), .DrpList
ComboBox 68, 24, 48, 40, MyList$(), .CmboBox
Text 12, 12, 32, 8, "List box:"
Text 124, 12, 68, 8, "Drop-down list:"
Language elements of SoftMaker Basic 52
Check boxes
Check boxes are suitable for "Yes/No" or "On/Off" choices.
Syntax:
OptionButton X, Y, Width, Height, Text, .ID1
OptionGroup .ID2
ID1 is a variable that contains the current state of the field.
ID2 is a variable that contains the index of the currently selected option.
Example:
Sub Main
Begin Dialog GroupSample 31, 32, 185, 96, "Radio buttons and group boxes"
OKButton 28, 68, 40, 14
CancelButton 120, 68, 40, 14
GroupBox 12, 8, 72, 52, "Group box", .GroupBox1
GroupBox 100, 8, 72, 52, "Group box", .GroupBox2
OptionGroup .OptionGroup1
OptionButton 16, 24, 54, 8, "Radio button", .OptionButton1
OptionButton 16, 40, 54, 8, "Radio button", .OptionButton2
CheckBox 108, 24, 50, 8, "Check box", .CheckBox1
CheckBox 108, 40, 50, 8, "Check box", .CheckBox2
End Dialog
Dim Dlg1 As GroupSample
Button = Dialog (Dlg1)
End Sub
Language elements of SoftMaker Basic 54
The dialog function returns a value if the user clicks on OK or Cancel. If you set this ReturnValue in the dialog
function to 0, the dialog will close; with any other value, the dialog stays open.
The parameters of the dialog function:
§ ControlID$
If Action = 2, this parameter contains the ID of the dialog control that the user activated (the value of the ID
was defined in the dialog definition).
§ Action%
1 when the dialog is initialized (in this case, the other parameters have no meaning).
2 when the user activates a dialog control. The dialog control is identified through ControlID$, and
SuppValue% contains additional information.
§ SuppValue%:
Information on the type of change that was made, depending on the type of the dialog control:
Check box: If the box is unchecked, this is 0, else 1.
Language elements of SoftMaker Basic 55
Radio button: The number of the selected radio button, with the first field of the radio button group
having the number 0.
Command button: No meaning
OK: 1
Cancel: 2
In the following example, the dialog function of a dialog is evaluated by means of a Case branch. The
parameter SuppValue is not tested in this example.
Sub Main
OLE Automation
With help from OLE Automation, suitable applications (such as TextMaker or PlanMaker) can be controlled
from SoftMaker Basic scripts.
Tip: Detailed information on programming TextMaker and PlanMaker can be found in the chapters
BasicMaker and TextMaker and BasicMaker and PlanMaker, respectively.
This must then be "connected" to the application. There are two functions for this: While CreateObject starts
the application automatically if it is not already running, GetObject can only connect to an instance of an
application that is already running.
Example:
Set MyObj = CreateObject("TextMaker.Application")
Language elements of SoftMaker Basic 57
The variable MyObj now contains a reference to the main OLE Automation object of the application and
incidentally its name is always Application. You can access its child objects through dot notation – for
example MyObj.Application.Documents (see also the next section).
If the OLE Automation connection is no longer needed, the variable should be separated from the object by
setting its value to Nothing:
Example:
Set MyObj = Nothing ' Detach variable from object
Properties
To access the properties of an object, use dot notation in the style Object.Property.
Example:
x = MyObj.Application.Width ' Retrieve the width of the program window
Or:
MyObj.Application.Width = 5 ' Set the width of the program window
Methods
When calling methods, dot notation is also used: Object.Method
Example:
MyObj.Application.Quit ' Exit from the application
Using collections
Apart from simple objects, there are also collections of objects.
TextMaker, for example, offers the collection Documents (a collection of all open documents). A collection is
itself an object that is usually accessible through a property of its parent object.
You can use the For Each Next statement to enumerate all elements of a collection.
All collections offer the following properties and methods by default:
Count Returns the number of elements (read-only).
Item(i) Provides the i-th element.
Add Adds a new object to the collection.
Example
Let us conclude with an example that demonstrates the use of OLE Automation in practice. The example uses
TextMaker's Documents collection which represents all currently open documents. In the first step, it is
determined how many documents are currently open. Then the names of the opened documents are output.
Finally, the documents are closed.
Language elements of SoftMaker Basic 58
Tip: Detailed information on the subjects BasicMaker and TextMaker and BasicMaker and PlanMaker can
be found in their respective chapters.
Sub Main
Dim tm As Object
Set tm = CreateObject("TextMaker.Application")
tm.Visible = True ' Make TextMaker visible
tm.Activate ' Bring TextMaker to the foreground
tm.Documents.Add ' Create three new documents
tm.Documents.Add
tm.Documents.Add
Print tm.Documents.Count & " open documents"
Dim x As Object
For Each x in tm.Documents
Print x.Name ' Output the names of the documents
Next
Programming TextMaker
Programming the word processor TextMaker and the spreadsheet program PlanMaker is practically identical.
The only difference is that some keywords have different names (for example PlanMaker.Application instead of
TextMaker.Application). If you have already worked through the section Programming PlanMaker you will
notice that the section you are currently reading is almost identical to it.
Naturally, the objects exposed by TextMaker are different from those of PlanMaker. A list of all objects
exposed can be found in the next section TextMaker's object model.
To program TextMaker with BasicMaker, you mainly use OLE Automation commands. General information on
this subject can be found in section OLE Automation.
Follow this schematic outline (see below for details):
1. Declare a variable of type Object:
Dim tm as Object
2. Make a connection to TextMaker via OLE Automation (this will launch TextMaker automatically if it is not
already running):
Set tm = CreateObject("TextMaker.Application")
4. Now you can program TextMaker by reading and writing its "properties" and by invoking the "methods" it
provides.
5. As soon as the TextMaker object is not required anymore, you should cut the connection to TextMaker:
BasicMaker and TextMaker 60
Set tm = Nothing
This was just a quick rundown of the necessary steps. More detailed information on programming TextMaker
follows on the next pages. A list of all TextMaker objects and their respective properties and methods can be
found in the section TextMaker's object model.
Connecting to TextMaker
In order to control TextMaker from BasicMaker, you first need to connect to TextMaker via OLE Automation.
For this, first declare a variable of type Object, then assign to it the object "TextMaker.Application" through
use of the CreateObject function.
Dim tm as Object
Set tm = CreateObject("TextMaker.Application")
If TextMaker is already running, this function simply connects to TextMaker; if not, then TextMaker will be
started beforehand.
The object variable "tm" now contains a reference to TextMaker.
Please note: If you start TextMaker 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.
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.
BasicMaker and TextMaker 61
Application.Name is a property that can only be read, but not written to. Other properties can be both retrieved
and changed from BasicMaker scripts. For example, the coordinates of the TextMaker application window are
stored in the properties Left, Top, Width und Height of the Application object. You can retrieve them as
follows:
MsgBox "The left window position is at: " & tm.Application.Left
TextMaker reacts immediately and moves the left border of the application window to the screen position 200.
You can also mix reading and changing the values of properties, as in the following example:
tm.Application.Left = tm.Application.Left + 100
Here, the current left border value is retrieved, increased by 100 and set as the new value for the left border.
This will instruct TextMaker to move its left window position 100 pixels to the right.
There is a large number of properties in the Application object. A list of them can be found in the section
TextMaker's object model.
Call as function:
Dim newDoc as Object
Set newDoc = tm.Documents.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:
tm.ActiveDocument.Tables.Add 3, 3 ' Insert a 3-by-3 table
Call as function:
Dim newTable as Object
Set newTable = tm.ActiveDocument.Tables.Add(3, 3) ' 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.
Using collections
The fourth group of members of the Application object are pointers to collections.
BasicMaker and TextMaker 63
Collections are, as their name indicates, lists of objects belonging together. For example, there is a collection
called Application.Documents that contains all open documents and a collection called
Application.RecentFiles with all files that are listed in the history section of the File menu.
There are two standardized ways of accessing collections and TextMaker supports both. The more simple way
is through the Item property that is part of every collection:
' Display the name of the first open document:
MsgBox tm.Application.Documents.Item(1).Name
' Close the (open) document "Test.tmdx":
tm.Application.Documents.Item("Test.tmdx").Close
If you wish to list all open documents, for example, first find out the number of open documents through the
standardized Count property, then access the objects one by one:
' Return the names of all open documents:
For i = 1 To tm.Application.Documents.Count
MsgBox tm.Application.Documents.Item(i).Name
Next i
Every collection contains, by definition, the Count property which lets you retrieve the number of entries in the
collection and the Item property that lets you directly access one entry.
Item always accepts the number of the desired entry as an argument. Where it makes sense, it is also possible to
pass other arguments to Item, for example file names. You have seen this already above, when we passed both
a number and a file name to Item.
For most collections, there is a matching object type for their individual entries. Individual entries of the
collection Windows, for example, that are returned by Item are of the type Window – note the use of the
singular! One entry of the Documents collection is called Document, and one entry of the RecentFiles
collection is called RecentFile.
This code looks much clearer through use of the With statement:
With tm.Application
.Left = 100
.Top = 50
.Width = 500
.Height = 300
.Options.CreateBackup = True
MsgBox .ActiveDocument.Name
End With
Easier:
Sub Better
BasicMaker and TextMaker 65
Dim tm As Object
Dim NewDocument As Object
Set tm = CreateObject("TextMaker.Application")
tm.Application.Visible = True ' Make TextMaker visible
Set NewDocument = tm.Application.Documents.Add ' Add document
NewDocument.Left = 100
NewDocument.Top = 50
NewDocument.Width = 222
NewDocument.Height = 80
End Sub
After you created the object variable "NewDocument" in the second example and stored a reference to the new
document in it (which conveniently is returned by the Add method of the Documents collection), you can
access the new document much more easily through this helper object variable.
Typically, the property that is used most often in an object has been designated its default property. For
example, the most used property of a collection surely is the Item property, as the most common use of
collections is to return one of their members. The following statements therefore are equivalent:
MsgBox tm.Application.Documents.Item(1).Name
Finally things are getting easier again!
But it gets even better: Name is the default property of a single Document object (note: "Document", not
"Documents"!). Each Item of the Document collection is of the Document type. As Name is the default
property of Document, it can be omitted:
MsgBox tm.Application.Documents(1)
Not easy enough yet? OK... Application is the default property of TextMaker. So, let's just leave out
Application as well! The result:
MsgBox tm.Documents(1)
This basic knowledge should have prepared you to understand TextMaker's object model. You can now
continue with the section TextMaker's object model that contains a detailed list of all objects that TextMaker
provides.
BasicMaker and TextMaker 66
CommandBars Collection Collection of all toolbars (toolbars work only in classic mode; they do not work
with ribbons)
CommandBar Object A single toolbar (toolbars work only in classic mode; they do not work with
ribbons)
Borders Collection Collection of all border lines (left, right, top, bottom, etc.) of a paragraph, a
table, a table row, or a cell
Shading Object The shading of paragraphs, tables, table rows and cells
RecentFiles Collection Collection of all recently opened files, as listed in the File menu
Detailed descriptions of all objects and collections follow on the next pages.
Application (object)
Access path: Application
1 Description
Application is the "root object" for all other objects in TextMaker. It is the central control object that is used to
carry out the whole communication between your Basic script and TextMaker.
Set tm = CreateObject("TextMaker.Application")
MsgBox tm.Application.Name
Set tm = CreateObject("TextMaker.Application")
MsgBox tm.Name ' has the same meaning as tm.Application.Name
Objects:
BasicMaker and TextMaker 69
§ ActiveDocument ® Document
§ ActiveWindow ® Window
§ Options ® Options
§ UserProperties ® UserProperties
§ CommandBars ® CommandBars
§ AutoCorrect ® AutoCorrect
§ Application ® Application
Collections:
§ Documents ® Documents
§ Windows ® Windows
§ RecentFiles ® RecentFiles
§ FontNames ® FontNames
Methods:
§ CentimetersToPoints
§ MillimetersToPoints
§ InchesToPoints
§ PicasToPoints
§ LinesToPoints
§ Activate
§ Quit
Visible (property)
Important: By default, Visible is set to False – thus, TextMaker is initially invisible until you explicitly
make it visible.
Left (property)
Top (property)
Width (property)
Height (property)
Gets or sets the height of the program window on the screen, measured in screen pixels.
WindowState (property)
DisplayScrollBars (property)
Returns the CommandBars object that you can use to access the toolbars of TextMaker.
Note: Toolbars work only in classic mode. They do not work with ribbons.
CentimetersToPoints (method)
Converts the given value from centimeters (cm) to points (pt). This function is useful when you make
calculations in centimeters, but a TextMaker function accepts only points as its measurement unit.
Syntax:
BasicMaker and TextMaker 73
CentimetersToPoints(Centimeters)
Parameters:
Centimeters (type: Single) specifies the value to be converted.
Return type:
Single
Example:
MillimetersToPoints (method)
Converts the given value from millimeters (mm) to points (pt). This function is useful if you make calculations
in millimeters, but a TextMaker function accepts only points as its measurement unit.
Syntax:
MillimetersToPoints(Millimeters)
Parameters:
Millimeters (type: Single) specifies the value to be converted.
Return type:
Single
Example:
InchesToPoints (method)
Converts the given value from inches to points (pt). This function is useful if you make calculations in inches,
but a TextMaker function accepts only points as its measurement unit.
Syntax:
InchesToPoints(Inches)
Parameters:
Inches (type: Single) specifies the value to be converted.
Return type:
Single
Example:
tm.ActiveDocument.PageSetup.BottomMargin = tm.Application.InchesToPoints(1)
PicasToPoints (method)
Converts the given value from picas to points (pt). This function is useful if you make calculations in picas, but
a TextMaker function accepts only points as its measurement unit.
Syntax:
PicasToPoints(Picas)
Parameters:
Picas (type: Single) specifies the value to be converted.
Return type:
Single
Example:
LinesToPoints (method)
Parameters:
Lines (type: Single) specifies the value to be converted.
Return type:
Single
Example:
Activate (method)
Brings the program window to the foreground and sets the focus to it.
Syntax:
Activate
Parameters:
none
BasicMaker and TextMaker 75
Return type:
none
Example:
Quit (method)
Ends the program.
Syntax:
Quit
Parameters:
none
Return type:
none
Example:
If there are any unsaved documents open, the user will be asked if they should be saved. If you want to avoid
this question, you need to either close all opened documents in your program or set the property Saved for the
documents to True (see Document).
Options (object)
Access path: Application à Options
1 Description
The Options object consolidates many global program settings, most of which can be found in the dialog box
of the ribbon command File | Options in TextMaker.
Set tm = CreateObject("TextMaker.Application")
tm.Application.Options.EnableSound = True
Objects:
§ Application ® Application
§ Parent ® Application
AutoFormatReplaceQuotes (property)
CheckSpellingAsYouType (property)
ShowSpellingErrors (property)
ShowGermanSpellingReformErrors (property)
CreateBackup (property)
DefaultFilePath (property)
DefaultTemplatePath (property)
EnableSound (property)
Overtype (property)
SaveInterval (property)
SavePropertiesPrompt (property)
AutoWordSelection (property)
PasteAdjustWordSpacing (property)
TabIndentKey (property)
DefaultFileFormat (property)
UserProperties (collection)
Access path: Application à UserProperties
1 Description
The UserProperties collection contains all components of the user's address (as entered on the General tab in
the dialog box of the ribbon command File | Options).
The individual elements of this collection are of the type UserProperty.
Objects:
§ Item ® UserProperty (default object)
§ Application ® Application
§ Parent ® Application
Examples:
UserProperty (object)
Access path: Application à UserProperties à Item
1 Description
A UserProperty object represents one individual component of the user's address (for example, the street or the
postal code).
An individual UserProperty object exists for each of these components. The number of these objects is
constant, since you cannot create new address components.
' Show the contents of the first address element (the name of the user)
MsgBox tm.Application.UserProperties.Item(1).Value
Properties:
§ Value (default property)
Objects:
§ Application ® Application
§ Parent ® UserProperties
Value (property)
Data type: String
Gets or sets the contents of the address component. The following example sets the company name of the user:
Sub Example()
Set tm = CreateObject("TextMaker.Application")
tm.UserProperties(smoUserDataCompany).Value = "ACME Corporation"
End Sub
CommandBars (collection)
Access path: Application à CommandBars
1 Description
The CommandBars collection contains all of TextMaker's toolbars. The individual elements of this collection
are of the type CommandBar.
Note: Toolbars work only in classic mode. They do not work with ribbons.
Objects:
§ Item ® CommandBar (default object)
§ Application ® Application
§ Parent ® Application
Returns the number of CommandBar objects in the collection, i.e. the number of toolbars available.
Note: Toolbars work only in classic mode. They do not work with ribbons.
DisplayFonts (property)
DisplayTooltips (property)
Note: It is not advisable to hard-code the names of toolbars in your program, since these names are different in
each language that TextMaker's user interface supports. For example, if the user interface language is set to
German, the name of the "Formatting" toolbar changes to "Format".
Instead, it is recommended to use the following symbolic constants for toolbars:
CommandBar (object)
Access path: Application à CommandBars à Item
1 Description
A CommandBar object represents one individual toolbar of TextMaker.
An individual CommandBar object exists for each toolbar. If you create new toolbars or delete them, the
respective CommandBar objects will be created or deleted dynamically.
Note: Toolbars work only in classic mode. They do not work with ribbons.
§ Visible
Objects:
§ Application ® Application
§ Parent ® CommandBars
Name (property)
Data type: String
Gets or sets the name of the toolbar.
Note: Toolbars work only in classic mode. They do not work with ribbons.
Example:
Visible (property)
Sub Example()
Set tm = CreateObject("TextMaker.Application")
tm.Application.CommandBars.Item("Formatting").Visible = False
End Sub
AutoCorrect (object)
Access path: Application à AutoCorrect
BasicMaker and TextMaker 86
1 Description
The AutoCorrect object contains settings related to automatic text correction and all SmartText entries.
Set tm = CreateObject("TextMaker.Application")
tm.Application.AutoCorrect.CorrectInitialCaps = True
Objects:
§ Application ® Application
§ Parent ® Application
Collections:
§ Entries ® AutoCorrectEntries
CorrectInitialCaps (property)
CorrectSentenceCaps (property)
ReplaceText (property)
AutoCorrectEntries (collection)
Access path: Application à AutoCorrect à Entries
1 Description
The AutoCorrectEntries collection contains all SmartText entries defined. The individual elements of this
collection are of the type AutoCorrectEntry.
Objects:
§ Item ® AutoCorrectEntry (default object)
§ Application ® Application
§ Parent ® AutoCorrect
Methods:
§ Add
' Show the contents of the SmartText entry with the name "sd"
MsgBox tm.Application.AutoCorrect.Entries.Item("sd").Value
Add (method)
Parameters:
BasicMaker and TextMaker 89
Name (type: String): The name of the new SmartText entry. If the name is empty or already exists, the
call to the method fails.
Value (type: String): The text for the new SmartText entry. If the passed string is empty, the call of the
method fails.
Return type:
Object (an AutoCorrectEntry object which represents the new SmartText entry)
Example:
AutoCorrectEntry (object)
Access path: Application à AutoCorrect à Entries à Item
1 Description
An AutoCorrectEntry object represents one individual SmartText entry, for example, "sd" for "sales
department".
An individual AutoCorrectEntry object exists for each SmartText entry. If you create SmartText entries or
delete them, the respective AutoCorrectEntry objects will be created or deleted dynamically.
Objects:
§ Application ® Application
§ Parent ® AutoCorrectEntries
BasicMaker and TextMaker 90
Methods:
§ Delete
Name (property)
Data type: String
Gets or sets the name of the SmartText entry (e.g. "sd").
Value (property)
Delete (method)
Parameters:
none
Return type:
none
Examples:
Documents (collection)
Access path: Application à Documents
1 Description
The Documents collection contains all open documents. The individual elements of this collection are of the
type Document.
Objects:
§ Item ® Document (default object)
§ Application ® Application
§ Parent ® Application
Methods:
§ Add
§ Open
§ Close
' Show the name of the document "Test.tmdx" (if currently open)
MsgBox tm.Application.Documents.Item("Test.tmdx").FullName
Add (method)
Creates a new empty document, based either on the standard document template Normal.tmvx or any other
document template you specify.
Syntax:
Add [Template]
Parameters:
Template (optional; type: String): Path and file name of the document template on which your
document should be based. If omitted, the standard template Normal.tmvx will be used.
If you omit the path or give only a relative path, TextMaker's default template path will be automatically
prefixed. If you omit the file extension .tmvx, it will be automatically added.
Return type:
Object (a Document object which represents the new document)
Example:
Sub Example()
Dim tm as Object
Dim newDoc as Object
Set tm = CreateObject("TextMaker.Application")
tm.Visible = True
BasicMaker and TextMaker 93
You can use the Document object returned by the Add method like any other document. Alternatively, you can
ignore the return value of the Add method and access the new document with the ActiveDocument method.
Open (method)
Opens an existing document.
Syntax:
Open FileName, [ReadOnly], [Password], [WritePassword], [Format]
Parameters:
FileName (type: String): Path and file name of the document or document template to be opened.
ReadOnly (optional; type: Boolean): Indicates whether the document should be opened only for reading.
Password (optional; type: String): The read password for password-protected documents. If you omit
this parameter for a password-protected document, the user will be asked to input the read password.
WritePassword (optional; type: String): The write password for password-protected documents. If you
omit this parameter for a password-protected document, the user will be asked to input the write
password.
Format (optional; Typ: Long bzw. TmSaveFormat): The file format of the document to be opened.
Possible values:
tmFormatDocument = 0 ' TextMaker document
tmFormatTemplate = 1 ' TextMaker document template
tmFormatWinWord97 = 2 ' Microsoft Word 97 and 2000
tmFormatOpenDocument = 3 ' OpenDocument, OpenOffice.org, StarOffice
tmFormatRTF = 4 ' Rich Text Format
tmFormatPocketWordPPC = 5 ' Pocket Word for Pocket PCs
tmFormatPocketWordHPC = 6 ' Pocket Word for Handheld PCs (Windows CE)
tmFormatPlainTextAnsi = 7 ' Text file with Windows character set
tmFormatPlainTextDOS = 8 ' Text file with DOS character set
tmFormatPlainTextUnicode = 9 ' Text file with Unicode character set
tmFormatPlainTextUTF8 = 10 ' Text file with UTF8 character set
tmFormatHTML = 12 ' HTML document
tmFormatWinWord6 = 13 ' Microsoft Word 6.0
tmFormatPlainTextUnix = 14 ' Text file for UNIX, Linux, FreeBSD
tmFormatWinWordXP = 15 ' Microsoft Word XP and 2003
tmFormatTM2006 = 16 ' TextMaker 2006 document
tmFormatOpenXML = 17 ' Microsoft Word 2007 and later
tmFormatTM2008 = 18 ' TextMaker 2008 document
tmFormatOpenXMLTemplate = 22 ' Microsoft Word document template 2007 and
later
tmFormatWinWordXPTemplate = 23 ' Microsoft Word document template XP and 2003
tmFormatTM2012 = 27 ' TextMaker 2012 document
tmFormatTM2016 = 28 ' TextMaker 2016 document
tmFormatTM2016Template = 29 ' TextMaker 2016 document template
Tip: Independent of the value for the FileFormat parameter, TextMaker always tries to determine the
file format by itself and ignores evidently false inputs.
Return type:
Object (a Document object which represents the opened document)
Examples:
Close (method)
Closes all currently open documents.
Syntax:
Close [SaveChanges]
Parameters:
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the documents which were
changed since they were last saved should be saved or not. If you omit this parameter, the user will be
asked to indicate it (if necessary). The possible values are:
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none
Example:
Document (object)
Access paths:
§ Application à Documents à Item
§ Application à ActiveDocument
§ Application à Windows à Item à Document
§ Application à ActiveWindow à Document
BasicMaker and TextMaker 95
1 Description
A Document object represents one individual document opened in TextMaker.
An individual Document object exists for each document. If you open or close documents, the respective
Document objects will be created or deleted dynamically.
§ Document is the Parent object for different objects which are linked with it, for example,
BuiltInDocumentProperties or Selection:
§ The objects Window and Selection include the object pointer to the document which belongs to them:
' Access the active document through the active document window
MsgBox tm.Application.ActiveWindow.Document.Name
Objects:
§ PageSetup ® PageSetup
BasicMaker and TextMaker 96
§ Selection ® Selection
§ ActiveWindow ® Window
§ Application ® Application
§ Parent ® Documents
Collections:
§ BuiltInDocumentProperties ® DocumentProperties
§ Paragraphs ® Paragraphs
§ Tables ® Tables
§ FormFields ® FormFields
Methods:
§ Activate
§ Close
§ Save
§ SaveAs
§ Select
§ MailMerge
§ PrintOut
§ MergePrintOut
Saved (property)
Gets or sets the Saved property of the document. It indicates whether a document was changed since it was last
saved:
§ If Saved is set to True, the document was not changed since it was last saved.
§ If Saved is set to False, the document was changed since it was last saved. When closing the document, the
user will be asked if it should be saved.
Note: As soon as the user changes something in a document, its Saved property will be set to False
automatically.
ReadOnly (property)
EnableCaretMovement (property)
MergeFileName (property)
MergeFileFormat (property)
tmMergeCSVAnsi = 3
tmMergeDBaseAnsi = 5
tmMergeCSVDos = 64
tmMergeDBaseDos = 66
tmMergeDBaseUnicode = 69
BasicMaker and TextMaker 98
MergeFileHeader (property)
MergeRecord (property)
Activate (method)
Brings the document window to the front (if Visible is True for the document) and sets the focus to the
document window.
Syntax:
Activate
Parameters:
none
Return type:
none
Example:
' Bring the first document of the Documents collection to the front
tm.Documents(1).Activate
Close (method)
Closes the document.
BasicMaker and TextMaker 100
Syntax:
Close [SaveChanges]
Parameters:
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the document should be
saved or not. If you omit this parameter, the user will be asked – but only if the document was changed
since it was last saved. The possible values for SaveChanges are:
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none
Example:
Save (method)
Saves the document.
Syntax:
Save
Parameters:
none
Return type:
none
Example:
SaveAs (method)
Parameters:
FileName (type: String): Path and file name under which the document should be saved.
FileFormat (optional; type: Long or TmSaveFormat) determines the file format. This parameter can
take the following values (left: the symbolic constants, right: the corresponding numeric values):
BasicMaker and TextMaker 101
' Save the current document under the given name in RTF format
tm.ActiveDocument.SaveAs "c:\docs\test.rtf", tmFormatRTF
Select (method)
Parameters:
none
Return type:
none
Example:
You can then use the Selection object to change, for example, the text formatting or to copy the selected text to
the clipboard.
PrintOut (method)
Prints the document on the currently selected printer.
Syntax:
PrintOut [From], [To]
Parameters:
From (optional; type: Long) indicates from which page to start. If omitted, printing starts from the first
page.
To (optional; type: Long) indicates at which page to stop. If omitted, printing stops at the last page.
Return type:
Boolean (True if printing was successful)
Example:
' Print out the pages 2-5 from the current document
tm.ActiveDocument.PrintOut 2, 5
MailMerge (method)
Transfers database fields from the assigned database into the document, using the record number specified in
the dialog box of the ribbon command File | Properties.
Syntax:
MailMerge Options, [ReplaceFields]
Parameters:
Options (type: Long or TmMergeOption) indicates what kind of data will be merged. The possible
values are:
tmSingleFax = 1
tmSingleAddress = 2
tmMultipleFax = 3
tmMultipleAddress = 4
ReplaceFields (optional; type: Boolean) determines whether the database fields in the document should
be physically replaced by the corresponding field contents. The default value is False.
Return type:
none
Example:
' Insert record #5 from the assigned database into the document
tm.ActiveDocument.MergeRecord = 5
BasicMaker and TextMaker 103
MergePrintOut (method)
Prints the document on the currently chosen printer as a merge document.
Syntax:
MergePrintOut [From], [To]
Parameters:
From (optional; type: Long) indicates the number of the first record to be printed. If omitted, printing
starts with the first record.
To (optional; type: Long) indicates the number of the last record to be printed. If omitted, printing stops
at the last record.
Return type:
Boolean (True if printing was successful)
Example:
DocumentProperties (collection)
Access paths:
§ Application à Documents à Item à DocumentProperties
§ Application à ActiveDocument à DocumentProperties
1 Description
The DocumentProperties collection contains all document properties of a document. This includes the title,
the author, the number of words, etc.
The individual elements of this collection are of the type DocumentProperty.
Objects:
§ Item ® DocumentProperty (default object)
§ Application ® Application
§ Parent ® Document
This list specifies all document properties that exist in SoftMaker Office, including those that are not available
in TextMaker. The latter are marked as "not available in TextMaker".
DocumentProperty (object)
Access paths:
§ Application à Documents à Item à BuiltInDocumentProperties à Item
§ Application à ActiveDocument à BuiltInDocumentProperties à Item
1 Description
A DocumentProperty object represents one individual document property of a document, for example, the
title, the author, or the number of words in a document.
Objects:
§ Application ® Application
§ Parent ® BuiltInDocumentProperties
' Show the name of the document property smoPropertyTitle, i.e. "Title"
MsgBox tm.ActiveDocument.BuiltInDocumentProperties.Item(smoPropertyTitle).Name
' Show the name of the document property "Author", i.e. "Author"
MsgBox tm.ActiveDocument.BuiltInDocumentProperties.Item("Author").Name
Value (property)
Data type: String
Gets or sets the content of a document property.
The following example assigns a value to the document property "Title" defined by the numeric constant
smoPropertyTitle and then reads its value again using the string constant "Title":
Sub Example()
Dim tm as Object
Set tm = CreateObject("TextMaker.Application")
tm.Documents.Add ' Add a new empty document
' Set the new title (using the numeric constant smoPropertyTitle)
tm.ActiveDocument.BuiltInDocumentProperties.Item(smoPropertyTitle).Value =
"New title"
' Get the exact same property again (using the string this time)
MsgBox tm.ActiveDocument.BuiltInDocumentProperties.Item("Title").Value
End Sub
Since Item is the default object of the DocumentProperties and Value is the default property of
DocumentProperty, the example can be written clearer in the following way:
Sub Example()
BasicMaker and TextMaker 107
Dim tm as Object
Set tm = CreateObject("TextMaker.Application")
tm.Documents.Add ' Add a new empty document
' Set the new title (using the numeric constant smoPropertyTitle)
tm.ActiveDocument.BuiltInDocumentProperties(smoPropertyTitle) = "New title"
' Get the exact same property again (using the string this time)
MsgBox tm.ActiveDocument.BuiltInDocumentProperties("Title")
End Sub
Sub Main()
Dim tm as Object
Dim i as Integer
Set tm = CreateObject("TextMaker.Application")
tm.Visible = True
tm.Documents.Add ' Add an empty document
With tm.ActiveDocument
For i = 1 to .BuiltInDocumentProperties.Count
If .BuiltInDocumentProperties(i).Valid then
Print i, .BuiltInDocumentProperties(i).Name, "=", _
.BuiltInDocumentProperties(i).Value
Else
Print i, "Not available in TextMaker"
End If
Next i
End With
End Sub
PageSetup (object)
Access paths:
§ Application à Documents à Item à PageSetup
§ Application à ActiveDocument à PageSetup
1 Description
The PageSetup object contains the page settings of the Document object to which it belongs. You can use it to
determine and change the paper size, page size and margins as well as the orientation of a document.
Note: TextMaker allows you to divide a document into multiple chapters and then define different page settings
for each of them. In this case, the PageSetup object always refers to the page settings of the chapter where the
text cursor is placed at the moment.
§ LeftMargin
§ RightMargin
§ TopMargin
§ BottomMargin
§ PageHeight
§ PageWidth
§ Orientation
§ PaperSize
Objects:
§ Application ® Application
§ Parent ® Document
LeftMargin (property)
RightMargin (property)
TopMargin (property)
BottomMargin (property)
PageHeight (property)
PageWidth (property)
Gets or sets the page width of the document in points (1 point corresponds to 1/72 inches).
If you set this property, the PaperSize property (see below) will be automatically changed to a suitable paper
format.
Orientation (property)
PaperSize (property)
smoPaperCustom = -1
smoPaperLetter = 1
smoPaperLetterSmall = 2
smoPaperTabloid = 3
smoPaperLedger = 4
smoPaperLegal = 5
smoPaperStatement = 6
smoPaperExecutive = 7
smoPaperA3 = 8
smoPaperA4 = 9
smoPaperA4Small = 10
smoPaperA5 = 11
smoPaperB4 = 12
smoPaperB5 = 13
smoPaperFolio = 14
smoPaperQuarto = 15
smoPaper10x14 = 16
smoPaper11x17 = 17
smoPaperNote = 18
smoPaperEnvelope9 = 19
smoPaperEnvelope10 = 20
smoPaperEnvelope11 = 21
smoPaperEnvelope12 = 22
smoPaperEnvelope14 = 23
smoPaperCSheet = 24
smoPaperDSheet = 25
smoPaperESheet = 26
smoPaperEnvelopeDL = 27
smoPaperEnvelopeC5 = 28
smoPaperEnvelopeC3 = 29
smoPaperEnvelopeC4 = 30
smoPaperEnvelopeC6 = 31
smoPaperEnvelopeC65 = 32
smoPaperEnvelopeB4 = 33
smoPaperEnvelopeB5 = 34
BasicMaker and TextMaker 111
smoPaperEnvelopeB6 = 35
smoPaperEnvelopeItaly = 36
smoPaperEnvelopeMonarch = 37
smoPaperEnvelopePersonal = 38
smoPaperFanfoldUS = 39
smoPaperFanfoldStdGerman = 40
smoPaperFanfoldLegalGerman = 41
Selection (object)
Access paths:
§ Application à Documents à Item à Selection
§ Application à ActiveDocument à Selection
1 Description
Selection represents the current selection in a document.
If text is selected, the Selection object represents the contents of this selection. If nothing is selected, the
Selection object represents the current cursor position. If you add text (for example, with the method
Selection.TypeText), the contents of the selected area will be replaced with this text. If nothing was selected,
the text will be pasted at the current cursor position.
You can use the Font object accessible from Selection to make changes in the text formatting. Example:
tmActiveDocumentSelectionFontSize = 24 changes the font size for the text selected in the active document
to 24 points.
' Copy the selection from the current document to the clipboard
tm.ActiveDocument.Selection.Copy
BasicMaker and TextMaker 112
Objects:
§ Document ® Document
§ Font ® Font
§ Application ® Application
§ Parent ® Document
Methods:
§ Copy
§ Cut
§ Paste
§ Delete
§ TypeText
§ TypeParagraph
§ TypeBackspace
§ InsertBreak
§ GoTo
§ ConvertToTable
§ SetRange
§ InsertPicture
Copy (method)
Parameters:
none
Return type:
none
Example:
Cut (method)
Cuts the content of the selection and places it in the clipboard.
Syntax:
Cut
Parameters:
none
Return type:
none
Example:
Paste (method)
Parameters:
none
Return type:
BasicMaker and TextMaker 114
none
Example:
' Replace the active selection with the contents of the clipboard
tm.ActiveDocument.Selection.Paste
Delete (method)
Parameters:
none
Return type:
none
Example:
TypeText (method)
Insert a string into the selection.
Syntax:
TypeText Text
Parameters:
Text (type: String) is the string to be inserted.
Return type:
none
Example:
' Insert text at the current cursor position in the active document
tm.ActiveDocument.Selection.TypeText "Programming with BasicMaker"
TypeParagraph (method)
Parameters:
none
Return type:
none
Example:
' Insert a carriage rueturn at the current cursor position in the active document
tm.ActiveDocument.Selection.TypeParagraph
TypeBackspace (method)
Parameters:
none
Return type:
none
Example:
' Execute a backspace at the current cursor position in the active document
tm.ActiveDocument.Selection.TypeBackspace
InsertBreak (method)
Inserts a manual break.
Syntax:
InsertBreak [Type]
Parameters:
Type (optional; type: Long or TmBreakType) defines the type of the break. The possible values are:
tmLineBreak = 0 ' Line break
tmColumnBreak = 1 ' Column break
tmSectionBreak = 2 ' Section break
tmPageBreak = 3 ' Page break
tmChapterBreak = 4 ' Chapter break
If you omit the Type parameter, the value tmPageBreak will be assumed.
Return type:
none
BasicMaker and TextMaker 116
Example:
GoTo (method)
Parameters:
What (optional; type: Long or TmGoToItem) indicates whether the destination is a table or a
paragraph:
tmGoToParagraph = 1 ' Paragraph
tmGoToTable = 2 ' Table
If you omit the What parameter, the value tmGoToParagraph will be assumed.
Which (optional; type: Long or TmGoToDirection) indicates whether the movement should be absolute
or relative to the current position:
tmGoToAbsolute = 1 ' absolute
tmGoToRelative = 2 ' relative
If you omit the Which parameter, the value tmGoToAbsolute will be assumed.
Count (optional; type: Long) indicates the number of the item (i.e. the index of the table or the index of
the paragraph in the document) that should be accessed.
If you omit the Count parameter, the value 1 will be assumed.
NumRow (optional; type: Long): If What is set to tmGoToTable, this parameter optionally allows you
to specify into which line of the table the cursor should be moved.
NumCol (optional; type: Long): If What is set to tmGoToTable, this parameter optionally allows you
to specify into which row of the table the cursor should be moved.
Return type:
none
Examples:
' Move the cursor to the first line of the first table
tm.ActiveDocument.Selection.GoTo tmGoToTable, tmGoToAbsolute, 1, 1, 1
BasicMaker and TextMaker 117
ConvertToTable (method)
Parameters:
NumRows (optional; type: Long) indicates how many rows the table should have. If omitted, TextMaker
will calculate the number of lines by itself.
NumCols (optional; type: Long) indicates how many columns the table should have. If omitted,
TextMaker will calculate the number of columns by itself.
Separator (optional; type: either String or Long or TmTableFieldSeparator) specifies one or more
characters that TextMaker should use to recognize the columns. You can provide either a string or one of
the following constants:
tmSeparateByCommas = 0 ' Columns separated by commas
tmSeparateByParagraphs = 1 ' Columns separated by paragraphs
tmSeparateByTabs = 2 ' Columns separated by tabs
tmSeparateBySemicolons = 3 ' Columns separated by semicolons
' Convert the current selection to a table. The column separator is the comma.
tm.ActiveDocument.Selection.ConvertToTable Separator := tmSeparateByCommas
SetRange (method)
Sets the start and end point of the selection by specifying their character positions.
Syntax:
SetRange Start, End
Parameters:
BasicMaker and TextMaker 118
Start (type: Long) sets the start position of the new selection, specified as the number of characters from
the document beginning.
End (type: Long) sets the end position of the new selection, specified as the number of characters from
the document beginning.
Return type:
none
Examples:
Tip: You can also use this method to select whole paragraphs. For this purpose, use the
Paragraph.Range.Start and Paragraph.Range.End values to indicate the start and end position of the
paragraph and pass them to the SetRange method.
InsertPicture (method)
Insert a picture from a file into the selection.
Syntax:
InsertPicture PictureName
Parameters:
PictureName (type: String) is the path and file name of the picture to be inserted.
Return type:
none
Examples:
Font (object)
Access paths:
§ Application à Documents à Item à Selection à Font
§ Application à ActiveDocument à Selection à Font
BasicMaker and TextMaker 119
1 Description
The Font object describes the character formatting of a text fragment. It is a child object of Selection and
allows you to get and set all character attributes of the current selection.
Objects:
§ Application ® Application
§ Parent ® Selection
Name (property)
Data type: String
Gets or sets the font name (as a string).
If multiple fonts are used inside the selection, an empty string will be returned.
BasicMaker and TextMaker 120
Size (property)
Bold (property)
Italic (property)
Underline (property)
If you are reading this property and the selection is partly underlined and partly not, the constant
smoUndefined will be returned.
StrikeThrough (property)
Superscript (property)
Subscript (property)
AllCaps (property)
SmallCaps (property)
PreferredSmallCaps (property)
Blink (property)
Color (property)
If the selection is formatted in different colors, the constant smoUndefined will be returned when you read this
property.
ColorIndex (property)
BColor (property)
BColorIndex (property)
Spacing (property)
Pitch (property)
Paragraphs (collection)
Access paths:
§ Application à Documents à Item à Paragraphs
§ Application à ActiveDocument à Paragraphs
1 Description
Paragraphs is a collection of all paragraphs in a document. The individual elements of this collection are of
the type Paragraph.
Objects:
§ Item ® Paragraph (default object)
§ Application ® Application
§ Parent ® Document
Paragraph (object)
Access paths:
§ Application à Documents à Item à Paragraphs à Item
§ Application à ActiveDocument à Paragraphs à Item
BasicMaker and TextMaker 126
1 Description
A Paragraph object represents one individual paragraph of the document and allows you to change its
formatting.
An individual Paragraph object exists for each paragraph. If you add paragraphs to a document or delete them,
the respective Paragraph objects will be created or deleted dynamically.
Objects:
§ Shading ® Shading
§ DropCap ® DropCap
§ Range ® Range
BasicMaker and TextMaker 127
§ Application ® Application
§ Parent ® Paragraphs
Collections:
§ Borders ® Borders
BorderBounds (property)
FirstLineIndent (property)
LeftIndent (property)
RightIndent (property)
LineSpacingRule (property)
LineSpacing (property)
Unlike the property PreferredLineSpacing (see below), the line spacing mode (see LineSpacingRule) is
ignored here – the line spacing will be always specified in points and normalized to a standard font size of 12
points.
In other words: No matter if the line spacing is set to "Automatically 100%", to "Exactly 12 pt" or to "At least
12 points", this property will always return the result 12.
PreferredLineSpacing (property)
SpaceBefore (property)
SpaceAfter (property)
Alignment (property)
Hyphenation (property)
OutlineLevel (property)
PageBreakBefore (property)
ColumnBreakBefore (property)
KeepWithNext (property)
KeepTogether (property)
Gets or sets the "Keep together" property of the paragraph (True or False).
WidowControl (property)
BorderClearance (property)
Gets or sets the spacing between the paragraph borders and the paragraph text. Each of the four sides can be
accessed individually.
Syntax 1 (setting a value):
BorderClearance(Index) = n
Parameters:
Index (type: Long or TmBorderClearance) indicates which side of the paragraph should be accessed:
tmBorderClearanceLeft = 1
tmBorderClearanceRight = 2
tmBorderClearanceTop = 3
tmBorderClearanceBottom = 4
' Set the spacing to the left border to 5 pt in the first paragraph
tm.ActiveDocument.Paragraphs(1).BorderClearance(tmBorderClearanceLeft) = 5
' Get the spacing to the left border in the first paragraph
MsgBox tm.ActiveDocument.Paragraphs(1).BorderClearance(tmBorderClearanceLeft)
Returns the DropCap object that describes the drop cap character of the paragraph.
Range (object)
Access paths:
§ Application à Documents à Item à Paragraphs à Item à Range
§ Application à ActiveDocument à Paragraphs à Item à Range
1 Description
The Range object is a child object of the Paragraph object. It returns the start and end position of the
paragraph, expressed as the number of characters from the top of the document.
' Display the end position of the first paragraph in the active document
MsgBox tm.ActiveDocument.Paragraphs.Item(1).Range.End
Objects:
§ Application ® Application
§ Parent ® Paragraph
With tm.ActiveDocument
.Selection.SetRange .Paragraphs(1).Range.Start, .Paragraphs(4).Range.End
End With
BasicMaker and TextMaker 133
DropCap (object)
Access paths:
§ Application à Documents à Item à Paragraphs à Item à DropCap
§ Application à ActiveDocument à Paragraphs à Item à DropCap
1 Description
The DropCap object describes the drop-cap character of a paragraph. It is a child object of Paragraph and
allows you to get and set the properties of the drop-cap character.
Objects:
§ Application ® Application
§ Parent ® Paragraph
FontName (property)
Size (property)
Position (property)
LeftMargin (property)
RightMargin (property)
TopMargin (property)
BottomMargin (property)
Gets or sets the bottom margin of the drop cap in points (1 point corresponds to 1/72 inches).
Tables (collection)
Access paths:
§ Application à Documents à Item à Tables
§ Application à ActiveDocument à Tables
1 Description
Tables is a collection of all tables in a document. The individual elements of this collection are of the type
Table.
Objects:
§ Item ® Table (default object)
§ Application ® Application
§ Parent ® Document
Methods:
BasicMaker and TextMaker 136
§ Add
Add (method)
Add a new table to the document at the current selection.
Syntax:
Add NumRows, NumColumns
Parameters:
NumRows (type: Long) defines the number of rows for the new table. If you specify a value of 0 or less,
the default value 3 will be used.
NumColumns (type: Long) defines the number of columns for the new table. If you specify a value of 0
or less, the default value 3 will be used.
Return type:
BasicMaker and TextMaker 137
Table (object)
Access paths:
§ Application à Documents à Item à Tables à Item
§ Application à ActiveDocument à Tables à Item
1 Description
A Table object represents one individual table of the document and allows you to change its formatting.
An individual Table object exists for each table. If you add tables to a document or delete them, the respective
Table objects will be created or deleted dynamically.
Objects:
§ Shading ® Shading
§ Cell ® Cell
§ Application ® Application
§ Parent ® Tables
Collections:
§ Rows ® Rows
§ Borders ® Borders
BasicMaker and TextMaker 138
Methods:
§ ConvertToText
Parameters:
Row (type: Long) specifies the row of the cell within the table.
Column (type: Long) specifies the column of the cell within the table.
Examples:
' Set the vertical alignment of cell B3 in the first table to "vertically
centered"
With tm.ActiveDocument
.Tables(1).Cell(2,3).VerticalAlignment = tmCellVerticalAlignmentCenter
End With
' The same, but with a detour through the Rows collection
With tm.ActiveDocument
.Tables(1).Rows(2).Cells(3).VerticalAlignment = tmCellVerticalAlignmentCenter
End With
Returns the Rows collection belonging to the table. You can use it to enumerate the individual rows in the
table, allowing you to get or set their formatting.
ConvertToText (method)
Parameters:
Separator (optional; type: either String or Long or TmTableFieldSeparator) indicates the character
that should be used to separate the columns. You can specify either an arbitrary character or one of the
following symbolic constants:
tmSeparateByCommas = 0 ' Columns separated by commas
tmSeparateByParagraphs = 1 ' Columns separated by paragraphs
tmSeparateByTabs = 2 ' Columns separated by tabs
tmSeparateBySemicolons = 3 ' Columns separated by semicolons
Rows (collection)
Access paths:
§ Application à Documents à Item à Tables à Item à Rows
§ Application à ActiveDocument à Tables à Item à Rows
1 Description
Rows is a collection of all table rows in a table. The individual elements of this collection are of the type Row.
BasicMaker and TextMaker 140
' Display the number of rows in the first table of the document
MsgBox tm.ActiveDocument.Tables(1).Rows.Count
Objects:
§ Item ® Row (default object)
§ Application ® Application
§ Parent ® Table
Row (object)
Access paths:
§ Application à Documents à Item à Tables à Item à Rows à Item
§ Application à ActiveDocument à Tables à Item à Rows à Item
1 Description
A Row object represents one individual table row of a table and allows you to change the formatting of this
table row.
An individual Row object exists for each table row. If you add the rows to a table or delete them, the respective
Row objects will be created or deleted dynamically.
' Display the height of the second row of the first table
MsgBox tm.ActiveDocument.Tables(1).Rows.Item(2).Height
Objects:
§ Shading ® Shading
§ Application ® Application
§ Parent ® Rows
Collections:
§ Cells ® Cells
§ Borders ® Borders
BasicMaker and TextMaker 142
Height (property)
HeightRule (property)
KeepTogether (property)
BreakPageAtRow (property)
AllowBreakInRow (property)
RepeatAsHeaderRow (property)
Cells (collection)
Access paths:
§ Application à Documents à Item à Tables à Item à Rows à Item à Cells
§ Application à ActiveDocument à Tables à Item à Rows à Item à Cells
BasicMaker and TextMaker 144
1 Description
Cells is a collection of all table cells in an individual table row. The individual elements of this collection are of
the type Cell.
' Display the number of cells in the secondnd row of the first table
MsgBox tm.ActiveDocument.Tables(1).Rows(2).Cells.Count
Objects:
§ Item ® Cell (default object)
§ Application ® Application
§ Parent ® Row
Cell (object)
Access paths:
§ Application à Documents à Item à Tables à Item à Cell(x, y) à Item
§ Application à ActiveDocument à Tables à Item à Cell(x, y) à Item
§ Application à Documents à Item à Tables à Item à Rows à Item à Cells à Item
§ Application à ActiveDocument à Tables à Item à Rows à Item à Cells à Item
1 Description
A Cell object represents one individual cell of a table row and allows you to retrieve and change the formatting
of this table cell.
An individual Cell object exists for each cell. If you add cells to a table row or delete them, the respective Cell
objects will be created or deleted dynamically.
' Set the width of the fifth cell in the second row of the first table to 25
tm.ActiveDocument.Tables(1).Rows(2).Cells(5).PreferredWidth = 25
Objects:
§ Shading ® Shading
§ Application ® Application
§ Parent ® Row
Collections:
§ Borders ® Borders
PreferredWidthType (property)
PreferredWidth (property)
Width (property)
VerticalAlignment (property)
Gets or sets the vertical alignment of the text inside the cell. The possible values are:
Orientation (property)
LockText (property)
LeftPadding (property)
RightPadding (property)
TopPadding (property)
BottomPadding (property)
Borders (collection)
Access paths for paragraph borders:
§ Application à Documents à Item à Paragraphs à Item à Borders
§ Application à ActiveDocument à Paragraphs à Item à Borders
Access paths for table borders:
§ Application à Documents à Item à Tables à Item à Borders
§ Application à ActiveDocument à Tables à Item à Borders
Access path for table row borders:
§ Application à Documents à Item à Tables à Item à Rows à Item à Borders
§ Application à ActiveDocument à Tables à Item à Rows à Item à Borders
Access path for table cell borders:
§ Application à Documents à Item à Tables à Item à Cell(x, y) à Borders
§ Application à ActiveDocument à Tables à Item à Cell(x, y) à Borders
§ Application à Documents à Item à Tables à Item à Rows à Item à Cells à Item à Borders
§ Application à ActiveDocument à Tables à Item à Rows à Item à Cells à Item à Borders
BasicMaker and TextMaker 149
1 Description
Borders is a collection of the border lines (left, right, top, bottom, etc.) of a paragraph, a table, a table row or a
cell. Accordingly, it is a child object of either Paragraph, Table, Row or Cell.
The individual elements of this collection are of the type Border.
Examples:
' Change the vertical grid lines of the second row in the first table
tm.ActiveDocument.Tables(1).Rows(2).Borders(tmBorderVertical).Color = smoColorRed
' Change the bottom border of the third cell in the second row from the first
table
tm.ActiveDocument.Tables(1).Rows(2).Cells(3).Borders(tmBorderBottom).Type =
tmLineStyleDouble
Objects:
§ Item ® Border (default object)
§ Application ® Application
§ Parent ® Paragraph, Table, Row or Cell
Returns the number of Border objects in the collection, i.e. the number of border lines available for the related
object:
§ When used as a child object of a Paragraph object, Count returns the value 5, since paragraphs have five
different types of border lines (left, right, top, bottom, between the paragraphs).
§ When used as a child object of a Table object, Count returns 6, since tables have six different types of
border lines (left, right, top, bottom, horizontal gutter, vertical gutter).
§ When used as a child object of a Row object, Count returns 5, since table rows have five different types of
border lines (left, right, top, bottom, vertical gutter).
§ When used as a child object of a Cell object, Count returns 4, since table cells have four different types of
border lines (left, right, top, bottom).
Sub Main
Dim tm as Object
Set tm = CreateObject("TextMaker.Application")
tm.Visible = True
BasicMaker and TextMaker 151
With tm.ActiveDocument.Paragraphs.Item(1)
.Borders(tmBorderLeft).Type = tmLineStyleSingle
.Borders(tmBorderLeft).Thick1 = 4
.Borders(tmBorderLeft).Color = smoColorBlue
.Borders(tmBorderRight).Type = tmLineStyleDouble
.Borders(tmBorderRight).Thick1 = 1
.Borders(tmBorderRight).Thick2 = 1
.Borders(tmBorderRight).Color = smoColorRed
End With
Set tm = Nothing
End Sub
Border (object)
Access paths for paragraph borders:
§ Application à Documents à Item à Paragraphs à Item à Borders à Item
§ Application à ActiveDocument à Paragraphs à Item à Borders à Item
Access paths for table borders:
§ Application à Documents à Item à Tables à Item à Borders à Item
§ Application à ActiveDocument à Tables à Item à Borders à Item
Access path for table row borders:
§ Application à Documents à Item à Tables à Item à Rows à Item à Borders à Item
§ Application à ActiveDocument à Tables à Item à Rows à Item à Borders à Item
Access path for table cell borders:
§ Application à Documents à Item à Tables à Item à Cell(x, y) à Borders à Item
§ Application à ActiveDocument à Tables à Item à Cell(x, y) à Borders à Item
§ Application à Documents à Item à Tables à Item à Rows à Item à Cells à Item à Borders à Item
§ Application à ActiveDocument à Tables à Item à Rows à Item à Cells à Item à Borders à Item
1 Description
A Border object represents one individual border line of a paragraph, a table, a table row or a table cell – for
example the left, right, top, or bottom line. You can use this object to get or change the line settings (thickness,
color, etc.) of a border line.
Some examples:
' Change the vertical grid lines of the second row in the first table
tm.ActiveDocument.Tables(1).Rows(2).Borders(tmBorderVertical).Color = smoColorRed
' Change the bottom border of the third cell in the second row from the first
table
tm.ActiveDocument.Tables(1).Rows(2).Cells(3).Borders(tmBorderBottom).Type =
tmLineStyleDouble
Objects:
§ Application ® Application
§ Parent ® Borders
Type (property)
Thick1 (property)
Thick2 (property)
Separation (property)
Color (property)
ColorIndex (property)
Shading (object)
Access paths for paragraph shading:
§ Application à Documents à Item à Paragraphs à Item à Shading
§ Application à ActiveDocument à Paragraphs à Item à Shading
Access paths for table shading:
§ Application à Documents à Item à Tables à Item à Shading
§ Application à ActiveDocument à Tables à Item à Shading
Access paths for table row shading:
§ Application à Documents à Item à Tables à Item à Rows à Item à Shading
§ Application à ActiveDocument à Tables à Item à Rows à Item à Shading
Access paths for table cell shading:
§ Application à Documents à Item à Tables à Item à Cell(x, y) à Shading
§ Application à ActiveDocument à Tables à Item à Cell(x, y) à Shading
§ Application à Documents à Item à Tables à Item à Rows à Item à Cells à Item à Shading
§ Application à ActiveDocument à Tables à Item à Rows à Item à Cells à Item à Shading
1 Description
The Shading object represents the shading of paragraphs, tables, table rows and cells. It is a child object of
Paragraph, Table, Row or Cell.
' Change the shading of the second row in the first table
tm.ActiveDocument.Tables(1).Rows(2).Shading.Texture = smoPatternHalftone
' Change the shading of the third cell in the second row from the first table
tm.ActiveDocument.Tables(1).Rows(2).Cells(3).Shading.Texture = smoPatternHalftone
§ ForegroundPatternColorIndex
§ BackgroundPatternColor
§ BackgroundPatternColorIndex
Objects:
§ Application ® Application
§ Parent ® Paragraph, Table, Row or Cell
Texture (property)
smoPatternNone = 0
smoPatternHalftone = 1
smoPatternRightDiagCoarse = 2
smoPatternLeftDiagCoarse = 3
smoPatternHashDiagCoarse = 4
smoPatternVertCoarse = 5
smoPatternHorzCoarse = 6
smoPatternHashCoarse = 7
smoPatternRightDiagFine = 8
smoPatternLeftDiagFine = 9
smoPatternHashDiagFine = 10
smoPatternVertFine = 11
smoPatternHorzFine = 12
smoPatternHashFine = 13
To add a shading, set the Texture property to smoPatternHalftone and specify the required intensity of
shading with the Intensity property.
To add a pattern, set the Texture property to one of the values from smoPatternRightDiagCoarse to
smoPatternHashFine.
To remove an existing shading or pattern, set the Texture property to smoPatternNone.
Intensity (property)
ForegroundPatternColor (property)
ForegroundPatternColorIndex (property)
BackgroundPatternColor (property)
BackgroundPatternColorIndex (property)
Sub Main
Dim tm as Object
Set tm = CreateObject("TextMaker.Application")
tm.Visible = True
With tm.ActiveDocument.Paragraphs.Item(1)
BasicMaker and TextMaker 157
.Shading.Texture = smoPatternHorzFine
.Shading.BackgroundPatternColor = smoColorAqua
End With
Set tm = Nothing
End Sub
FormFields (collection)
Access paths:
§ Application à Documents à Item à FormFields
§ Application à ActiveDocument à FormFields
1 Description
FormFields is a collection of all form objects (text fields, check boxes and drop-down lists) in a document. The
individual elements of this collection are of the type FormField.
DisplayFieldNames (property)
Shaded (property)
' Show the numeric type of the first form field in the document
MsgBox tm.ActiveDocument.FormFields(1).Type
' Show the numeric type of the form field named "DropDown1"
MsgBox tm.ActiveDocument.FormFields("DropDown1").Type
FormField (object)
Access paths:
§ Application à Documents à Item à FormFields à Item
§ Application à ActiveDocument à FormFields à Item
BasicMaker and TextMaker 159
1 Description
A FormField object represents one individual form object of a document and allows you to retrieve the value it
returns or to change its formatting.
Each form object can represent either a text field, a check box or a drop-down list.
An individual FormField object exists for each form object. If you add form objects to a document or delete
them, the respective FormField objects will be created or deleted dynamically.
' Show the name of the first form object in the document
MsgBox tm.ActiveDocument.FormFields(1).Name
Text fields, check boxes and drop-down lists have common properties as well as type-specific ones. Accessing
these properties can be performed in different ways:
§ Properties that are available in all form objects (for example, whether they are visible) can be found directly
in the FormField object. Details on these properties will follow below.
§ Properties that are type-specific (for example, only selection lists possess a list of all their elements) can be
found in the TextInput, CheckBox and DropDown child objects. These properties are documented for each
child object.
Properties:
§ Name
§ Visible
§ Printable
§ Locked
§ Tabstop
§ Type R/O
§ Result R/O
Objects:
§ TextInput ® TextInput
§ CheckBox ® CheckBox
§ DropDown ® DropDown
§ Application ® Application
§ Parent ® FormFields
BasicMaker and TextMaker 160
Name (property)
Visible (property)
Printable (property)
Locked (property)
Tabstop (property)
TextInput (object)
Access paths:
§ Application à Documents à Item à FormFields à Item à TextInput
§ Application à ActiveDocument à FormFields à Item à TextInput
1 Description
A TextInput object represents one individual form object of the type TextInput and allows you to retrieve and
change its value.
A TextInput object can be any of the following object types:
§ a text field, created with the ribbon command Insert | Objects group | Form object | Text field;
§ a text frame, created with the ribbon command Insert | Objects group | Text frame; or
§ a drawing, to which text has been added using the Add text command.
TextInput is a child object of FormField.
If tm.ActiveDocument.FormFields(1).TextInput.Valid Then
MsgBox tm.ActiveDocument.FormFields(1).TextInput.Text
End If
Objects:
§ Application ® Application
§ Parent ® FormField
BasicMaker and TextMaker 163
Text (property)
Data type: String
Gets or sets the content of the text field.
LockText (property)
CheckBox (object)
Access paths:
§ Application à Documents à Item à FormFields à Item à CheckBox
§ Application à ActiveDocument à FormFields à Item à CheckBox
1 Description
A CheckBox object represents one individual form object of the type CheckBox and allows you to retrieve and
change its value.
CheckBox is a child object of FormField.
BasicMaker and TextMaker 164
If tm.ActiveDocument.FormFields(1).CheckBox.Valid Then
MsgBox tm.ActiveDocument.FormFields(1).CheckBox.Value
End If
Objects:
§ Application ® Application
§ Parent ® FormField
Value (property)
Data type: Boolean
Gets or sets the property whether the check box is checked or not (True or False).
Text (property)
DropDown (object)
Access paths:
§ Application à Documents à Item à FormFields à Item à DropDown
§ Application à ActiveDocument à FormFields à Item à DropDown
1 Description
A DropDown object represents one individual form object of the type DropDown (drop-down list) and allows
you to retrieve and change its value.
DropDown is a child object of FormField
If tm.ActiveDocument.FormFields(1).DropDown.Valid Then
MsgBox tm.ActiveDocument.FormFields(1).DropDown.Value
End If
Objects:
§ Application ® Application
BasicMaker and TextMaker 166
§ Parent ® FormField
Value (property)
Data type: Long
Gets or sets the numeric index of the selected list entry.
ListEntries (collection)
Access paths:
§ Application à Documents à Item à FormFields à Item à DropDown à ListEntries
§ Application à ActiveDocument à FormFields à Item à DropDown à ListEntries
1 Description
ListEntries is a collection of all list entries of a DropDown object. This allows you to view and edit the
individual entries in a selection list.
The individual elements of this collection are of the type ListEntry.
BasicMaker and TextMaker 167
' Show the number of list entries in the first form element
' (if it is really a drop-down list)
If tm.ActiveDocument.FormFields(1).DropDown.Valid Then
MsgBox tm.ActiveDocument.FormFields(1).DropDown.ListEntries.Count
End If
Objects:
§ Item ® ListEntry (default object)
§ Application ® Application
§ Parent ® DropDown
Methods:
§ Add
§ Clear
Add (method)
Adds a new entry to the drop-down list.
Syntax:
Add Name
Parameters:
Name (type: String) specifies the string to be added.
Return type:
Object (a ListEntry object that represents the new entry)
Example:
' Add an entry to the first form field in the document (a drop-down list)
tm.ActiveDocument.FormFields(1).DropDown.ListEntries.Add "Green"
' The same, but using the return value (mind the parentheses!)
Dim entry as Object
Set entry = tm.ActiveDocument.FormFields(1).DropDown.ListEntries.Add("Green")
Clear (method)
Parameters:
none
Return type:
none
Example:
BasicMaker and TextMaker 169
' Delete all entries from the first form field in the document
tm.ActiveDocument.FormFields(1).DropDown.ListEntries.Clear
ListEntry (object)
Access paths:
§ Application à Documents à Item à FormFields à Item à DropDown à ListEntries à Item
§ Application à ActiveDocument à FormFields à Item à DropDown à ListEntries à Item
1 Description
A ListEntry object represents one individual entry in a drop-down list (a form object) and allows you to
retrieve, change and delete it.
An individual ListEntry object exists for each entry in a drop-down list. If you add entries to a drop-down list
or delete them, the respective ListEntry objects will be created or deleted dynamically.
' Show an entry from the first form field in the document (a drop-down list)
MsgBox tm.ActiveDocument.FormFields(1).DropDown.ListEntries.Item(1).Name
Objects:
§ Application ® Application
§ Parent ® ListEntries
Methods:
§ Delete
Name (property)
Data type: String
Gets or sets the content of the ListEntry object – in other words: the content of the respective list entry.
Examples:
BasicMaker and TextMaker 170
Note: You can use this method to replace the text only in already existing list entries. If you want to add new
entries to the list, use the method Add from the ListEntries collection.
Delete (method)
Parameters:
none
Return type:
none
Example:
Windows (collection)
Access path: Application à Windows
BasicMaker and TextMaker 171
1 Description
The Windows collection contains all open document windows. The individual elements of this collection are of
the type Window.
Objects:
§ Item ® Window (default object)
§ Application ® Application
§ Parent ® Application
' Show the name of the document window "Test.tmdx" (if currently open)
MsgBox tm.Application.Windows.Item("Test.tmdx").FullName
' You can also use the full name with path
BasicMaker and TextMaker 172
MsgBox tm.Application.Windows.Item("c:\Documents\Test.tmdx").FullName
Window (object)
Access paths:
§ Application à Windows à Item
§ Application à ActiveWindow
§ Application à Documents à Item à ActiveWindow
§ Application à ActiveDocument à ActiveWindow
1 Description
A Window object represents one individual document window that is currently open in TextMaker.
An individual Window object exists for each document window. If you open or close document windows, the
respective Window objects will be created or deleted dynamically.
§ You can access the currently active document window through Application.ActiveWindow:
MsgBox tm.Application.ActiveWindow.View.Parent.Name
§ The object Document contains an object pointer to the respective document window:
' Access the active document window through the active document
MsgBox tm.Application.ActiveDocument.ActiveWindow.Name
Objects:
§ Document ® Document
§ View ® View
§ Application ® Application
§ Parent ® Windows
Methods:
§ Activate
§ Close
Returns the path of the document opened in the window (e.g., c:\Letters).
Left (property)
Top (property)
Width (property)
Height (property)
WindowState (property)
DisplayHorizontalRuler (property)
DisplayVerticalRuler (property)
DisplayRulers (property)
DisplayHorizontalScrollBar (property)
DisplayVerticalScrollBar (property)
Activate (method)
Brings the document window to the foreground (if the property Visible for this document is True) and sets the
focus to it.
Syntax:
Activate
Parameters:
none
Return type:
none
Example:
Close (method)
Closes the document window.
Syntax:
Close [SaveChanges]
Parameters:
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the document opened in the
window should be saved or not (if it was changed since last save). If you omit this parameter, the user
will be asked to indicate it (if necessary). The possible values for SaveChanges are:
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none
Example:
View (object)
Access paths:
BasicMaker and TextMaker 177
1 Description
The View object contains a range of settings for the presentation on screen. It is a child object of the Window
object.
Note: The presentation settings provided by the View object are specific to the document window – i.e., each
document window has its own settings. The global settings (valid for all documents) can be found in the objects
Application and Options.
' Show all special characters (tabs, etc.) in the active window
tm.ActiveWindow.View.ShowAll = True
Objects:
§ Zoom ® Zoom
§ Application ® Application
§ Parent ® Window
BasicMaker and TextMaker 178
Type (property)
Mode (property)
If you set this property to tmViewModeObject while the document window view (see above) is set to
tmNormalView (ribbon command View group | Views | Concept) or tmOutlineView (ribbon command View
| Views group | Outline), TextMaker automatically switches to tmPrintView because object mode is not
available in these views.
FieldShading (property)
HighlightComments (property)
RevisionsBalloonSide (property)
RevisionsBalloonWidth (property)
CommentsPaneAutoShow (property)
ShowHiddenText (property)
PrintHiddenText (property)
ShowParagraphs (property)
ShowSpaces (property)
ShowTabs (property)
ShowAll (property)
ShowBookmarks (property)
ShowTextBoundaries (property)
WrapToWindow (property)
Zoom (object)
Access paths:
§ Application à Windows à Item à View à Zoom
§ Application à ActiveWindow à View à Zoom
§ Application à Documents à Item à ActiveWindow à View à Zoom
§ Application à ActiveDocument à ActiveWindow à View à Zoom
1 Description
The Zoom object contains the settings for the zoom level of a document window. It is a child object of the
View object.
Objects:
§ Application ® Application
§ Parent ® View
Percentage (property)
RecentFiles (collection)
Access path: Application à RecentFiles
1 Description
RecentFiles is a collection of all recently opened files listed in the File menu. The individual elements of this
collection are of the type RecentFile.
' Show the name of the first recent file in the File menu
MsgBox tm.Application.RecentFiles.Item(1).Name
Objects:
§ Item ® RecentFile (default object)
§ Application ® Application
§ Parent ® Application
Methods:
§ Add
BasicMaker and TextMaker 183
Add (method)
Parameters:
Document is a string containing the file path and name of the document to be added.
BasicMaker and TextMaker 184
FileFormat (optional; type: Long or TmSaveFormat) specifies the file format of the document to be
added. The possible values are:
tmFormatDocument = 0 ' TextMaker document
tmFormatTemplate = 1 ' TextMaker document template
tmFormatWinWord97 = 2 ' Microsoft Word 97 and 2000
tmFormatOpenDocument = 3 ' OpenDocument, OpenOffice.org, StarOffice
tmFormatRTF = 4 ' Rich Text Format
tmFormatPocketWordPPC = 5 ' Pocket Word for Pocket PCs
tmFormatPocketWordHPC = 6 ' Pocket Word for Handheld PCs (Windows CE)
tmFormatPlainTextAnsi = 7 ' Text file with Windows character set
tmFormatPlainTextDOS = 8 ' Text file with DOS character set
tmFormatPlainTextUnicode = 9 ' Text file with Unicode character set
tmFormatPlainTextUTF8 = 10 ' Text file with UTF8 character set
tmFormatHTML = 12 ' HTML document
tmFormatWinWord6 = 13 ' Microsoft Word 6.0
tmFormatPlainTextUnix = 14 ' Text file for UNIX, Linux, FreeBSD
tmFormatWinWordXP = 15 ' Microsoft Word XP and 2003
tmFormatTM2006 = 16 ' TextMaker 2006 document
tmFormatOpenXML = 17 ' Microsoft Word 2007 and later
tmFormatTM2008 = 18 ' TextMaker 2008 document
tmFormatOpenXMLTemplate = 22 ' Microsoft Word document template 2007 and
later
tmFormatWinWordXPTemplate = 23 ' Microsoft Word document template XP and 2003
tmFormatTM2012 = 27 ' TextMaker 2012 document
tmFormatTM2016 = 28 ' TextMaker 2016 document
tmFormatTM2016Template = 29 ' TextMaker 2016 document template
' Do the same, but evaluate the return value (mind the parentheses!)
Dim fileObj as Object
Set fileObj = tm.Application.RecentFiles.Add("Test.rtf", tmFormatRTF)
MsgBox fileObj.Name
RecentFile (object)
Access path: Application à RecentFiles à Item
BasicMaker and TextMaker 185
1 Description
A RecentFile object represents one individual of the recently opened files. You can use it to retrieve the
properties of such a file and to open it again.
An individual RecentFile object exists for each recently opened file. For each document that you open or close,
the list of these files in the File menu will change accordingly – i.e., the respective RecentFile objects will be
created or deleted dynamically.
' Show the name of the first file in the File menu
MsgBox tm.Application.RecentFiles.Item(1).Name
Objects:
§ Application ® Application
§ Parent ® RecentFiles
Methods:
§ Open
Open (method)
Parameters:
none
Return type:
Document
Example:
FontNames (collection)
Access path: Application à FontNames
1 Description
FontNames is a collection of all fonts installed in Windows. The individual elements of this collection are of
the type FontName.
BasicMaker and TextMaker 187
Objects:
§ Item ® FontName (default object)
§ Application ® Application
§ Parent ® Application
FontName (object)
Access path: Application à FontNames à Item
1 Description
A FontName object represents one individual font of the fonts installed in Windows. An individual FontName
object exists for each installed font.
Objects:
§ Application ® Application
§ Parent ® FontNames
Programming PlanMaker
Programming the word processor TextMaker and the spreadsheet program PlanMaker is practically identical.
The only difference is that some keywords have different names (for example PlanMaker.Application instead of
TextMaker.Application). If you have already worked through the section Programming TextMaker you will
notice that the section you are currently reading is almost identical to it.
Naturally, the objects exposed by PlanMaker are different from those of TextMaker. A list of all objects
exposed can be found in the next section, PlanMaker's object model.
To program PlanMaker with BasicMaker, you mainly use OLE Automation commands. General information on
this subject can be found in section OLE Automation.
Follow this schematic outline (see below for details):
1. Declare a variable of type Object:
Dim pm as Object
2. Make a connection to PlanMaker via OLE Automation (PlanMaker will be launched automatically if it is
not already running):
Set pm = CreateObject("PlanMaker.Application")
4. Now you can program PlanMaker by reading and writing its "properties" and by invoking the "methods" it
provides.
5. As soon as the PlanMaker object is not required anymore, you should cut the connection to PlanMaker:
Set pm = Nothing
BasicMaker and PlanMaker 191
This was just a quick rundown of the necessary steps. More detailed information on programming PlanMaker
follows on the next pages. A list of all PlanMaker objects and their respective properties and methods can be
found in the section PlanMaker's object model.
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.
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.
BasicMaker and PlanMaker 192
Application.Name is a property that can only be read, but not written to. Other properties can be both retrieved
and changed from BasicMaker scripts. For example, the coordinates of the PlanMaker application window are
stored in the properties Left, Top, Width and Height. You can retrieve them as follows:
MsgBox "The left window position is at: " & tm.Application.Left
PlanMaker reacts immediately and moves the left border of the application window to the pixel position 200.
You can also mix reading and changing the values of properties, as in the following example:
pm.Application.Left = pm.Application.Left + 100
Here, the current left border value is retrieved, increased by 100 and set as the new value for the left border.
This will instruct PlanMaker to move its left window position 100 pixels to the right.
There is a large number of properties in the Application object. A list of them can be found in the section
PlanMaker's object model.
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.
Using collections
The fourth group of members of the Application object are pointers to collections.
BasicMaker and PlanMaker 194
Collections are, as their name indicates, lists of objects belonging together. For example, there is a collection
called Application.Workbooks that contains all open documents and a collection called
Application.RecentFiles with all files that are listed in the history section of the File menu.
There are two standardized ways of accessing collections and PlanMaker supports both. The more simple way
is through the Item property that is part of every collection:
' Display the name of the first open document:
MsgBox pm.Application.Workbooks.Item(1).Name
' Close the (open) document "Test.pmdx":
pm.Application.Workbooks.Item("Test.pmdx").Close
If you wish to list all open documents, for example, first find out the number of open documents through the
standardized Count property, then access the objects one by one:
' Return the names of all open documents:
For i = 1 To pm.Application.Workbooks.Count
MsgBox pm.Application.Workbooks.Item(i).Name
Next i
Every collection contains, by definition, the Count property which lets you retrieve the number of entries in the
collection and the Item property that lets you directly access one entry.
Item always accepts the number of the desired entry as an argument. Where it makes sense, it is also possible to
pass other arguments to Item, for example file names. You have seen this already above, when we passed both
a number and a file name to Item.
For most collections, there is a matching object type for their individual entries. The collection Windows, for
example, an individual entry that is returned by Item is of the type Window – note the use of the singular! One
entry of the Workbooks collection is called Workbook, and an entry of the RecentFiles collection is called
RecentFile.
This code looks much clearer through use of the With statement:
With pm.Application
.Left = 100
.Top = 50
.Width = 500
.Height = 300
MsgBox .Options.CreateBackup
End With
Typically, the property that is used most often in an object has been designated its default property. For
example, the most used property of a collection surely is the Item property, as the most common use of
collections is to return one of their members. The following statements therefore are equivalent:
MsgBox pm.Application.Workbooks.Item(1).Name
MsgBox pm.Application.Workbooks(1).Name
Finally things are getting easier again! But it gets even better: Name is the default property of a single
Workbook object (note: "Workbook", not "Workbooks"!). Each Item of the Workbook collection is of the
Workbook type. As Name is the default property of Document, it can be omitted:
BasicMaker and PlanMaker 196
MsgBox pm.Application.Workbooks(1)
Not easy enough yet? OK... Application is the default property of PlanMaker. So, let's just leave out
Application as well! The result:
MsgBox pm.Workbooks(1)
This basic knowledge should have prepared you to understand PlanMaker's object model. You can now
continue with the next section that contains a detailed list of all objects that PlanMaker provides.
CommandBars Collection Collection of all toolbars (toolbars work only in classic mode; they do not work
with ribbons)
CommandBar Object A single toolbar (toolbars work only in classic mode; they do not work with
ribbons)
RecentFiles Collection Collection of all recently opened files, as listed in the File menu
Detailed descriptions of all objects and collections follow on the next pages.
BasicMaker and PlanMaker 198
Application (object)
Access path: Application
1 Description
Application is the "root object" for all other objects in PlanMaker. It is the central control object that is used to
carry out the whole communication between your Basic script and PlanMaker.
Set pm = CreateObject("PlanMaker.Application")
MsgBox pm.Application.Name
Set pm = CreateObject("PlanMaker.Application")
MsgBox pm.Name ' has the same meaning as pm.Application.Name
Objects:
§ Options ® Options
§ UserProperties ® UserProperties
§ CommandBars ® CommandBars
§ AutoCorrect ® AutoCorrect
§ ActiveWorkbook ® Workbook
§ ActiveSheet ® Sheet
§ ActiveWindow ® Window
§ ActiveCell ® Range
§ Selection ® Range
§ Range ® Range
§ Cells ® Range
§ Application ® Application
Collections:
§ Workbooks ® Workbooks
§ Windows ® Windows
§ RecentFiles ® RecentFiles
§ FontNames ® FontNames
§ Columns ® Columns
§ Rows ® Rows
Methods:
§ CentimetersToPoints
§ MillimetersToPoints
§ InchesToPoints
§ PicasToPoints
§ LinesToPoints
§ Activate
§ Calculate
§ Quit
Visible (property)
Important: By default, Visible is set to False – thus, PlanMaker is initially invisible until you explicitly
make it visible.
Left (property)
Top (property)
Width (property)
Gets or sets the width of the program window on the screen, measured in screen pixels.
Height (property)
WindowState (property)
Calculation (property)
Notes:
§ PlanMaker allows you to apply this setting per document, whereas it is a global setting in Excel. This
property is supported by PlanMaker only for compatibility reasons. It is recommended to use the identically
named property Calculation in the Workbook object instead, as it allows you to change this setting for
each document individually.
§ If you retrieve this property while multiple documents are open where this setting has different values, the
value smoUndefined will be returned.
CalculateBeforeSave (property)
named property CalculateBeforeSave in the Workbook object instead, as it allows you to change this
setting for each document individually.
§ If you retrieve this property while multiple documents are open where this setting has different values, the
value smoUndefined will be returned.
DisplayCommentIndicator (property)
Notes:
§ PlanMaker allows you to apply this setting per document, whereas it is a global setting in Excel. This
property is supported by PlanMaker only for compatibility reasons. It is recommended to use the identically
named property DisplayCommentIndicator in the Workbook object instead, as it allows you to change
this setting for each document individually.
§ If you retrieve this property while multiple documents are open where this setting has different values, the
value smoUndefined will be returned.
EditDirectlyInCell (property)
MoveAfterReturn (property)
MoveAfterReturnDirection (property)
pmUp = 1 ' up
pmToRight = 2 ' right
pmToLeft = 3 ' left
PromptForSummaryInfo (property)
WarningOnError (property)
MsgBox pm.Application.ActiveWorkbook.ActiveSheet
MsgBox pm.Application.ActiveSheet
pm.Application.ActiveWindow.ActiveCell.Font.Size = 14
pm.Application.ActiveCell.Font.Size = 14
Please note that ActiveCell always returns just one single cell, even if a range of cells is selected in the
worksheet. After all, selected ranges have exactly one active cell as well. You can see that when you select cells
and then press the Enter key: a cell frame appears within to selection to indicate the active cell.
pm.Application.ActiveWorkbook.ActiveSheet.Selection.Font.Size = 14
pm.Application.Selection.Font.Size = 14
BasicMaker and PlanMaker 205
Syntax 2:
obj = Range(Cell1, Cell2)
Parameters:
Cell1 (type: String) specifies either according to syntax 1 a cell range (then Cell2 must be omitted) or
according to syntax 2 the upper left corner of a range (then parameter Cell2 specifies the lower right
corner of the range).
Cell2 (optional; type: String) should be used only if Cell1 refers to an individual cell.
Examples for syntax 1:
Range("A1:B20") ' Cells A1 to B20
Range("A1") ' Only cell A1
Range("A:A") ' Column A as a whole
Range("3:3") ' Row 3 as a whole
Range("Summer") ' Named range "Summer"
Range is an abbreviation for ActiveWorkbook.ActiveSheet.Range. The following both calls have the same
meaning:
pm.Application.ActiveWorkbook.ActiveSheet.Range("A1:B5").Value = 42
pm.Application.Range("A1:B5").Value = 42
§ To address individual cells with loop variables instead of specifying the address as a string (such as "B5" for
the second column in the fifth row). To do this, use the Item property of the Range object that is addressed
through the Cells pointer:
BasicMaker and PlanMaker 206
Cells is an abbreviation for ActiveSheet.Cells. The following both calls have the same meaning:
pm.Application.ActiveSheet.Cells(1, 1).Font.Size = 14
pm.Application.Cells(1, 1).Font.Size = 14
Returns the Application object, i.e. the pointer to itself. This object pointer is basically superfluous and only
provided for the sake of completeness.
Columns is an abbreviation for ActiveWorkbook.ActiveSheet.Columns. The following both calls have the
same meaning:
MsgBox pm.Application.ActiveWorkbook.ActiveSheet.Columns.Count
MsgBox pm.Application.Columns.Count
MsgBox pm.Application.ActiveWorkbook.ActiveSheet.Rows.Count
MsgBox pm.Application.Rows.Count
CentimetersToPoints (method)
Converts the given value from centimeters (cm) to points (pt). This function is useful if you make calculations
in centimeters, but a PlanMaker function accepts only points as its measurement unit.
Syntax:
CentimetersToPoints(Centimeters)
Parameters:
Centimeters (type: Single) specifies the value to be converted.
Return type:
Single
Example:
MillimetersToPoints (method)
Converts the given value from millimeters (mm) to points (pt). This function is useful if you make calculations
in millimeters, but a PlanMaker function accepts only points as its measurement unit.
Syntax:
MillimetersToPoints(Millimeters)
Parameters:
Millimeters (type: Single) specifies the value to be converted.
Return type:
BasicMaker and PlanMaker 208
Single
Example:
InchesToPoints (method)
Converts the given value from inches (in) to points (pt). This function is useful if you make calculations in
inches, but a PlanMaker function accepts only points as its measurement unit.
Syntax:
InchesToPoints(Inches)
Parameters:
Inches (type: Single) specifies the value to be converted.
Return type:
Single
Example:
PicasToPoints (method)
Converts the given value from picas to points (pt). This function is useful if you make calculations in picas, but
a PlanMaker function accepts only points as its measurement unit.
Syntax:
PicasToPoints(Picas)
Parameters:
Picas (type: Single) specifies the value to be converted.
Return type:
Single
Example:
LinesToPoints (method)
Syntax:
LinesToPoints(Lines)
Parameters:
Lines (type: Single) specifies the value to be converted.
Return type:
Single
Example:
Activate (method)
Brings the program window to the foreground and sets the focus to it.
Syntax:
Activate
Parameters:
none
Return type:
none
Example:
Calculate (method)
Recalculates all currently open documents (similar to the ribbon command Formula | Update group | Update
data | Update calculations in PlanMaker, except that the ribbon command only recalculates the active
workbook).
Syntax:
Calculate
Parameters:
none
Return type:
none
BasicMaker and PlanMaker 210
Example:
Quit (method)
Parameters:
none
Return type:
none
Example:
If there are any unsaved documents open, the user will be asked if they should be saved. If you want to avoid
this question, you need to either close all opened documents in your program or set the property Saved for the
document to True (see Workbook).
Options (object)
Access path: Application à Options
1 Description
The Options object consolidates many global program settings, most of which can be found in the dialog box
of the ribbon command File | Options in PlanMaker.
Set pm = CreateObject("PlanMaker.Application")
pm.Application.Options.EnableSound = True
BasicMaker and PlanMaker 211
Objects:
§ Application ® Application
§ Parent ® Application (default object)
CheckSpellingAsYouType (property)
CreateBackup (property)
DefaultFilePath (property)
DefaultTemplatePath (property)
EnableSound (property)
Overtype (property)
SaveInterval (property)
SavePropertiesPrompt (property)
DefaultFileFormat (property)
UserProperties (collection)
Access path: Application à UserProperties
1 Description
The UserProperties collection contains all components of the user's address (as entered on the General tab in
the dialog box of the ribbon command File | Options).
The individual elements of this collection are of the type UserProperty.
Objects:
§ Item ® UserProperty (default object)
§ Application ® Application
§ Parent ® Application
Which UserProperty object you get depends on the numeric value that you pass to Item. The following table
shows the admissible values:
Examples:
UserProperty (object)
Access path: Application à UserProperties à Item
BasicMaker and PlanMaker 215
1 Description
A UserProperty object represents one individual component of the user's address (for example, the street or the
postal code).
An individual UserProperty object exists for each of these components. The number of these objects is
constant, since you cannot create new address components.
' Show the contents of the first address element (the name of the user)
MsgBox pm.Application.UserProperties.Item(1).Value
Objects:
§ Application ® Application
§ Parent ® UserProperties
Value (property)
Data type: String
Gets or sets the contents of the address component. The following example sets the company name of the user:
Sub Example()
Set pm = CreateObject("PlanMaker.Application")
pm.UserProperties(smoUserDataCompany).Value = "ACME Corporation"
End Sub
CommandBars (collection)
Access path: Application à CommandBars
1 Description
The CommandBars collection contains all of PlanMaker's toolbars. The individual elements of this collection
are of the type CommandBar.
Note: Toolbars work only in classic mode. They do not work with ribbons.
Objects:
§ Item ® CommandBar (default object)
§ Application ® Application
§ Parent ® Application
DisplayFonts (property)
DisplayTooltips (property)
Note: It is not advisable to hard-code the names of toolbars in your program, since these names are different in
each language that PlanMaker's user interface supports. For example, if you are using PlanMaker in English, the
format bar is not called "Format", but "Formatting".
Instead, it is recommended to use the following symbolic constants for toolbars:
CommandBar (object)
Access path: Application à CommandBars à Item
1 Description
A CommandBar object represents one individual toolbar in PlanMaker.
An individual CommandBar object exists for each toolbar. If you create new toolbars or delete them, the
respective CommandBar objects will be created or deleted dynamically.
Note: Toolbars work only in classic mode. They do not work with ribbons.
Objects:
BasicMaker and PlanMaker 219
§ Application ® Application
§ Parent ® CommandBars
Name (property)
Data type: String
Gets or sets the name of the toolbar.
Note: Toolbars work only in classic mode. They do not work with ribbons.
Example:
Visible (property)
Sub Example()
Set pm = CreateObject("PlanMaker.Application")
pm.Application.CommandBars.Item("Formatting").Visible = False
End Sub
AutoCorrect (object)
Access path: Application à AutoCorrect
BasicMaker and PlanMaker 220
1 Description
The AutoCorrect object allows accessing the defined SmartText entries.
Collections:
§ Entries ® AutoCorrectEntries
AutoCorrectEntries (collection)
Access path: Application à AutoCorrect à Entries
BasicMaker and PlanMaker 221
1 Description
The AutoCorrectEntries collection contains all SmartText entries defined in PlanMaker. The individual
elements of this collection are of the type AutoCorrectEntry.
Objects:
§ Item ® AutoCorrectEntry (default object)
§ Application ® Application
§ Parent ® AutoCorrect
Methods:
§ Add
' Show the contents of the SmartText entry with the name "sd"
MsgBox pm.Application.AutoCorrect.Entries.Item("sd").Value
BasicMaker and PlanMaker 222
Add (method)
Parameters:
Name (type: String): The name of the new SmartText entry. If the name is empty or already exists, the
call to the method fails.
Value (type: String): The text for the new SmartText entry. If the passed string is empty, the call of the
method fails.
Return type:
Object (an AutoCorrectEntry object which represents the new SmartText entry)
Example:
AutoCorrectEntry (object)
Access path: Application à AutoCorrect à Entries à Item
1 Description
An AutoCorrectEntry object represents one individual SmartText entry, for example, "sd" for "sales
department".
An individual AutoCorrectEntry object exists for each SmartText entry. If you create SmartText entries or
delete them, the respective AutoCorrectEntry objects will be created or deleted dynamically.
BasicMaker and PlanMaker 223
Objects:
§ Application ® Application
§ Parent ® AutoCorrectEntries
Methods:
§ Delete
Name (property)
Data type: String
Gets or sets the name of the SmartText entry (e.g. "sd").
Value (property)
Delete (method)
Parameters:
none
Return type:
none
Examples:
Workbooks (collection)
Access path: Application à Workbooks
1 Description
The Workbooks collection contains all open documents. The individual elements of this collection are of the
type Workbook.
Objects:
§ Item ® Workbook (default object)
§ Application ® Application
§ Parent ® Application
Methods:
§ Add
§ Open
§ Close
' Show the name of the document "Test.pmdx" (if currently open)
MsgBox pm.Application.Workbooks.Item("Test.pmdx").FullName
' You can also use the full name with path
MsgBox pm.Application.Workbooks.Item("c:\Documents\Test.pmdx").FullName
Add (method)
Creates a new empty document, based either on the standard document template Normal.pmvx or any other
document template you specify.
Syntax:
Add [Template]
BasicMaker and PlanMaker 226
Parameters:
Template (optional; type: String): Path and file name of the document template on which your
document should be based. If omitted, the standard template Normal.pmvx will be used.
If you omit the path or give only a relative path, PlanMaker's default template path will be automatically
prefixed. If you omit the file extension .pmvx, it will be automatically added.
Return type:
Object (a Workbook object that represents the new document)
Example:
Sub Example()
Dim pm as Object
Dim newDoc as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
Set newDoc = pm.Workbooks.Add
MsgBox newDoc.Name
End Sub
You can use the Workbook object returned by the Add method like any other document. You can also ignore
the return value of Add and get the new document from ActiveWorkbook.
Open (method)
Parameters:
FileName (type: String): Path and file name of the document or document template to be opened.
ReadOnly (optional; type: Boolean): Indicates whether the document should be opened only for reading.
Format (optional; type: Long or PmSaveFormat): The file format of the document to be opened. The
possible values are:
pmFormatDocument = 0 ' PlanMaker document
pmFormatTemplate = 1 ' PlanMaker document template
pmFormatExcel97 = 2 ' Excel 97/2000/XP
pmFormatExcel5 = 3 ' Excel 5.0/7.0
pmFormatExcelTemplate = 4 ' Excel document template
pmFormatSYLK = 5 ' Sylk
pmFormatRTF = 6 ' Rich Text Format
pmFormatTextMaker = 7 ' TextMaker (= RTF)
pmFormatHTML = 8 ' HTML document
pmFormatdBaseDOS = 9 ' dBASE database with DOS character set
pmFormatdBaseAnsi = 10 ' dBASE database with Windows character set
pmFormatDIF = 11 ' Text file with Windows character set
pmFormatPlainTextAnsi = 12 ' Text file with Windows character set
BasicMaker and PlanMaker 227
Return type:
Object (a workbook object that represents the opened document)
Examples:
Close (method)
Parameters:
BasicMaker and PlanMaker 228
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the documents which were
changed since they were last saved should be saved or not. If you omit this parameter, the user will be
asked to indicate it (if necessary). The possible values for SaveChanges are:
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none
Example:
Workbook (object)
Access paths:
§ Application à Workbooks à Item
§ Application à ActiveWorkbook
§ Application à Windows à Item à Workbook
§ Application à ActiveWindow à Workbook
1 Description
A Workbook object represents one individual document opened in PlanMaker.
For each document there is its own Workbook object. If you open or close documents, the respective
Workbook objects will be created or deleted dynamically.
§ Workbook is the Parent of the Sheets object, a collection of all worksheets in a document:
BasicMaker and PlanMaker 229
§ The Window object includes an object pointer to the document that belongs to it:
' Access the active document through the active document window
MsgBox pm.Application.ActiveWindow.Workbook.Name
Objects:
§ ActiveSheet ® Sheet
§ ActiveWindow ® Window
§ BuiltInDocumentProperties ® DocumentProperties
§ Application ® Application
§ Parent ® Workbooks
Collections:
§ Sheets ® Sheets
Methods:
§ Activate
§ Calculate
§ Close
§ Save
§ SaveAs
BasicMaker and PlanMaker 230
§ PrintOut
Saved (property)
ReadOnly (property)
EnableCaretMovement (property)
If EnableCaretMovement is True, the text cursor can be moved freely inside a write-protected document. If it
is set to False, cursor movement is not possible.
ManualApply (property)
ScreenUpdate (property)
Calculation (property)
CalculateBeforeSave (property)
CalculateBeforeCopying (property)
This property has an effect only if the document is set to be recalculated manually. If the Calculation property
(see there) is set to pmCalculationAutomatic, all calculations will always be kept up-to-date anyway.
CalculateBeforePrinting (property)
DisplayCommentIndicator (property)
FixedDecimal (property)
' Move the decimal separator 2 positions to the left after input
pm.ActiveWorkbook.FixedDecimal = True
pm.ActiveWorkbook.FixedDecimalPlaces = 2 ' 4235 will become 42.35
' Move the decimal separator 2 positions to the right after input
pm.ActiveWorkbook.FixedDecimal = True
pm.ActiveWorkbook.FixedDecimalPlaces = -2 ' 42 will become 4200
FixedDecimalPlaces (property)
Iteration (property)
MaxIteration (property)
MaxChange (property)
ShowGuideLinesForTextFrames (property)
ShowHiddenObjects (property)
RoundFinalResults (property)
RoundIntermediateResults (property)
Gets or sets the setting "Round intermediate results" on the Calculate tab in the dialog box of the ribbon
command File | Properties.
Activate (method)
Brings the document window to the front (if Visible is True for the document) and sets the focus to the
document window.
Syntax:
Activate
BasicMaker and PlanMaker 235
Parameters:
none
Return type:
none
Example:
' Bring the first document in the Workbooks collection to the front
pm.Workbooks(1).Activate
Calculate (method)
Recalculates the document (corresponds to the ribbon command Formulas | Update group | Update data |
Update calculations in PlanMaker).
Syntax:
Calculate
Parameters:
none
Return type:
none
Example:
Close (method)
Closes the document.
Syntax:
Close [SaveChanges]
Parameters:
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the document should be
saved or not. If you omit this parameter, the user will be asked – but only if the document was changed
since it was last saved. The possible values for SaveChanges are:
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none
BasicMaker and PlanMaker 236
Example:
Save (method)
Parameters:
none
Return type:
none
Example:
SaveAs (method)
Parameters:
FileName (type: String): Path and file name under which the document should be saved.
FileFormat (optional; type: Long or PmSaveFormat) determines the file format. This parameter can
take the following values (left: the symbolic constants, right: the corresponding numeric values):
pmFormatDocument = 0 ' PlanMaker document
pmFormatTemplate = 1 ' PlanMaker document template
pmFormatExcel97 = 2 ' Excel 97/2000/XP
pmFormatExcel5 = 3 ' Excel 5.0/7.0
pmFormatExcelTemplate = 4 ' Excel document template
pmFormatSYLK = 5 ' Sylk
pmFormatRTF = 6 ' Rich Text Format
pmFormatTextMaker = 7 ' TextMaker (= RTF)
pmFormatHTML = 8 ' HTML document
pmFormatdBaseDOS = 9 ' dBASE database with DOS character set
pmFormatdBaseAnsi = 10 ' dBASE database with Windows character set
pmFormatDIF = 11 ' Text file with Windows character set
pmFormatPlainTextAnsi = 12 ' Text file with Windows character set
pmFormatPlainTextDOS = 13 ' Text file with DOS character set
pmFormatPlainTextUnix = 14 ' Text file with ANSI character set for UNIX,
Linux, FreeBSD
BasicMaker and PlanMaker 237
Return type:
none
Example:
' Save the current document under a new name in Excel 97 format
pm.ActiveWorkbook.SaveAs "c:\docs\test.xls", pmFormatExcel97
PrintOut (method)
Prints the document.
Syntax:
PrintOut [From], [To]
Parameters:
From (optional; type: Long) indicates from which page to start. If omitted, printing starts from the first
page.
To (optional; type: Long) indicates at which page to stop. If omitted, printing stops at the last page.
Return type:
none
Example:
DocumentProperties (collection)
Access paths:
§ Application à Workbooks à Item à DocumentProperties
§ Application à ActiveWorkbook à DocumentProperties
1 Description
The DocumentProperties collection contains all document properties of a document. These include, for
example, the title, author, number of cells filled with content, etc.
The individual elements of this collection are of the type DocumentProperty.
Objects:
§ Item ® DocumentProperty (default object)
§ Application ® Application
§ Parent ® Workbook
This list specifies all document properties that exist in SoftMaker Office, including those that are not available
in PlanMaker. The latter are marked as "not available in PlanMaker".
DocumentProperty (object)
Access paths:
§ Application à Workbooks à Item à BuiltInDocumentProperties à Item
§ Application à ActiveWorkbook à BuiltInDocumentProperties à Item
1 Description
A DocumentProperty object represents one individual document property of a document, for example, the
title, the author, or the number of charts in a document.
Objects:
§ Application ® Application
§ Parent ® BuiltInDocumentProperties
' Show the name of the document property smoPropertyTitle, i.e. "Title"
MsgBox pm.ActiveWorkbook.BuiltInDocumentProperties.Item(smoPropertyTitle).Name
' Show the name of the document property "Author", i.e. "Author"
MsgBox pm.ActiveWorkbook.BuiltInDocumentProperties.Item("Author").Name
BasicMaker and PlanMaker 241
Value (property)
Data type: String
Gets or sets the content of a document property.
The following example assigns a value to the document property "Title" defined by the numeric constant
smoPropertyTitle and then reads its value again using the string constant "Title":
Sub Main()
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Workbooks.Add ' Add a new empty document
With pm.ActiveWorkbook
' Set the new title (using the numeric constant smoPropertyTitle)
.BuiltInDocumentProperties.Item(smoPropertyTitle).Value = "New title"
' Get the exact same property again (using the string this time)
MsgBox .BuiltInDocumentProperties.Item("Title").Value
End With
End Sub
Since Item is the default object of the DocumentProperties and Value is the default property of
DocumentProperty, the example can be written clearer in the following way:
Sub Main()
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Workbooks.Add ' Add a new empty document
With pm.ActiveWorkbook
' Set the new title (using the numeric constant smoPropertyTitle)
.BuiltInDocumentProperties(smoPropertyTitle) = "New title"
' Get the exact same property again (using the string this time)
MsgBox .BuiltInDocumentProperties("Title")
End With
End Sub
The Valid property allows you to test whether the respective document property is available in PlanMaker
before using it. Example:
Sub Main()
Dim pm as Object
Dim i as Integer
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
pm.Workbooks.Add ' add an empty document
With pm.ActiveWorkbook
For i = 1 to .BuiltInDocumentProperties.Count
If .BuiltInDocumentProperties(i).Valid then
Print i, .BuiltInDocumentProperties(i).Name, "=", _
.BuiltInDocumentProperties(i).Value
Else
Print i, "Not available in PlanMaker"
End If
Next i
End With
End Sub
Sheets (collection)
Access paths:
§ Application à Workbooks à Item à Sheets
§ Application à ActiveWorkbook à Sheets
1 Description
The Sheets collection contains all worksheets of a document. The individual elements of this collection are of
the type Sheet.
Objects:
§ Item ® Sheet
§ Application ® Application
§ Parent ® Workbook
Methods:
§ Add
Which Sheet object you get depends on the value that you pass to Item. You can specify either the numeric
index or the name of the worksheet:
' Show the name of the worksheet with the name "Income"
MsgBox pm.Application.ActiveWorkbook.Sheets.Item("Income").Name
Add (method)
Adds a new empty worksheet to the document and returns the Sheet object that represents this new worksheet.
Syntax:
Add [Name]
Parameters:
Name (optional; type: String): The name for the new worksheet. If you omit this parameter, the name is
automatically generated ("Table1", "Table2", "Table3", etc.).
Return type:
Object
Example:
Sub Main()
Dim pm as Object
Dim newDoc as Object
Dim newSheet as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
You can use the Sheet object returned by the Add method like any other worksheet. You can also ignore the
return value of Add and get the new worksheet via ActiveSheet.
Sheet (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item
§ Application à Workbooks à ActiveSheet
§ Application à ActiveWorkbook à ActiveSheet
§ Application à ActiveSheet
1 Description
A Sheet object represents an individual worksheet of a document opened in PlanMaker.
An individual Sheet object exists for each worksheet. If you add worksheets to the document or delete them,
the respective Sheet objects will be created or deleted dynamically.
§ The active worksheet of a document can be retrieved from the Workbook.ActiveSheet object:
§ The active worksheet of the active document can be retrieved from the Application.ActiveSheet object:
' Display the name of the active worksheet in the active document
MsgBox pm.Application.ActiveSheet.Name
§ Sheet is the Parent object for several objects that are linked to it, for example, Range or AutoFilter:
§ Index R/O
§ Hidden
§ PageBreaks
§ DisplayRowHeadings
§ DisplayColumnHeadings
§ AutoFilterMode
Objects:
§ PageSetup ® PageSetup
§ Selection ® Range
§ Rows ® Rows
§ Columns ® Columns
§ Cells ® Range
§ Range ® Range
§ AutoFilter ® AutoFilter
§ Application ® Application
§ Parent ® Sheets
Methods:
§ Activate
§ Calculate
§ Delete
§ Move
§ Select
§ ShowAllData
Name (property)
Data type: String
Gets or sets the name of the worksheet.
Hidden (property)
PageBreaks (property)
Gets or sets the setting whether page breaks should be displayed in the worksheet. Corresponds to the setting
Page breaks in the dialog box of the ribbon command Insert | Tables group | Sheet | Properties in PlanMaker.
DisplayRowHeadings (property)
DisplayColumnHeadings (property)
DisplayGridlines (property)
GridlineColor (property)
GridlineColorIndex (property)
AutoFilterMode (property)
Gets or sets the setting whether drop-down arrows should be shown for the active AutoFilter.
Note: You can always read this setting. But if you want to set it, you should note that this property can only be
used to hide the drop-down arrows. To show the drop-down arrows, you must invoke the AutoFilter method
from the Range object instead.
BasicMaker and PlanMaker 248
' Set the font for all cells in row 10 to Courier New
pm.ActiveSheet.Rows(10).Font.Name = "Courier New"
' Set the font for all cells in column C (= 3rd column) to Courier New
pm.ActiveSheet.Columns(3).Font.Name = "Courier New"
§ You can address the individual cells using loop variables instead of manually building a string with the cell
address (for example, "B5" for the second column in the fifth row). To do this, use the Item property of the
Range object returned by the Cells pointer, for example:
Syntax 2:
obj = Range(Cell1, Cell2)
Parameters:
Cell1 (type: String) specifies either according to syntax 1 a cell range (then Cell2 must be omitted) or
according to syntax 2 the upper left corner of a range (then parameter Cell2 specifies the lower right
corner of the range).
Cell2 (optional; type: String) should be used only if Cell1 refers to an individual cell.
Examples for syntax 1:
Range("A1:B20") ' Cells A1 to B20
Range("A1") ' Only cell A1
Range("A:A") ' The whole column A
Range("3:3") ' The whole row 3
Range("Summer") ' Named range "Summer"
Example:
Activate (method)
Parameters:
none
Return type:
none
Example:
' Bring the first sheet of the active document to the front
pm.ActiveWorkbook.Sheets(1).Activate
Calculate (method)
Recalculates the worksheet (similar to the ribbon command Formulas | Update group | Update data | Update
calculations in PlanMaker, except that the ribbon command recalculates all worksheets of a workbook).
Syntax:
Calculate
Parameters:
none
Return type:
none
Example:
BasicMaker and PlanMaker 251
Delete (method)
Deletes the worksheet from the document.
Syntax:
Delete
Parameters:
none
Return type:
none
Example:
Move (method)
Parameters:
Index (type: Long) indicates the target position.
Return type:
none
Example:
Select (method)
Selects all cells of the worksheet (corresponds to the ribbon command Home | Selection group | Select all in
PlanMaker).
Syntax:
Select
Parameters:
BasicMaker and PlanMaker 252
none
Return type:
none
Example:
ShowAllData (method)
Makes all cells visible again that are currently hidden by an AutoFilter. Corresponds to clicking the entry
"(All)" in the drop-down menu that appears when you click on the arrow button of an AutoFilter.
PageSetup (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à PageSetup
§ Application à Workbooks à ActiveSheet à PageSetup
§ Application à ActiveWorkbook à ActiveSheet à PageSetup
§ Application à ActiveSheet à PageSetup
1 Description
The PageSetup object contains the page settings of the Sheet object to which it belongs. You can use it to
determine and change the paper size, page size and margins as well as the print direction of a single worksheet.
Note: You can define different page settings for each individual worksheet in a document.
§ HeaderMargin
§ FooterMargin
§ PageHeight
§ PageWidth
§ Orientation
§ PaperSize
§ PrintComments
§ CenterHorizontally
§ CenterVertically
§ Zoom
§ FirstPageNumber
§ PrintGridlines
§ PrintHeadings
§ Order
§ PrintArea
§ PrintTitleRows
§ PrintTitleColumns
Objects:
§ Application ® Application
§ Parent ® Sheet
LeftMargin (property)
RightMargin (property)
TopMargin (property)
BottomMargin (property)
HeaderMargin (property)
Gets or sets the distance between the header and the top edge of the sheet in points (1 point corresponds to 1/72
inches).
FooterMargin (property)
PageHeight (property)
PageWidth (property)
Orientation (property)
PaperSize (property)
smoPaperCustom = -1
smoPaperLetter = 1
smoPaperLetterSmall = 2
smoPaperTabloid = 3
smoPaperLedger = 4
smoPaperLegal = 5
smoPaperStatement = 6
smoPaperExecutive = 7
BasicMaker and PlanMaker 255
smoPaperA3 = 8
smoPaperA4 = 9
smoPaperA4Small = 10
smoPaperA5 = 11
smoPaperB4 = 12
smoPaperB5 = 13
smoPaperFolio = 14
smoPaperQuarto = 15
smoPaper10x14 = 16
smoPaper11x17 = 17
smoPaperNote = 18
smoPaperEnvelope9 = 19
smoPaperEnvelope10 = 20
smoPaperEnvelope11 = 21
smoPaperEnvelope12 = 22
smoPaperEnvelope14 = 23
smoPaperCSheet = 24
smoPaperDSheet = 25
smoPaperESheet = 26
smoPaperEnvelopeDL = 27
smoPaperEnvelopeC5 = 28
smoPaperEnvelopeC3 = 29
smoPaperEnvelopeC4 = 30
smoPaperEnvelopeC6 = 31
smoPaperEnvelopeC65 = 32
smoPaperEnvelopeB4 = 33
smoPaperEnvelopeB5 = 34
smoPaperEnvelopeB6 = 35
smoPaperEnvelopeItaly = 36
smoPaperEnvelopeMonarch = 37
smoPaperEnvelopePersonal = 38
smoPaperFanfoldUS = 39
smoPaperFanfoldStdGerman = 40
smoPaperFanfoldLegalGerman = 41
PrintComments
CenterHorizontally
CenterVertically
Zoom
FirstPageNumber
PrintGridlines
PrintHeadings
Order
Corresponds to the setting "Print order" on the Options tab in the dialog box of the ribbon command File |
Print group | Page setup.
BasicMaker and PlanMaker 257
PrintArea
PrintTitleRows
PrintTitleColumns
Range (object)
Access paths (for arbitrary cell ranges):
§ Application à Workbooks à Item à Sheets à Item à Range
§ Application à Workbooks à ActiveSheet à Range
§ Application à ActiveWorkbook à ActiveSheet à Range
§ Application à ActiveSheet à Range
§ Application à Range
Access paths (for entire table rows):
§ Application à Workbooks à Item à Sheets à Item à Rows à Item
§ Application à Workbooks à ActiveSheet à Rows à Item
§ Application à ActiveWorkbook à ActiveSheet à Rows à Item
§ Application à ActiveSheet à Rows à Item
§ Application à Rows à Item
Access paths (for entire table columns):
§ Application à Workbooks à Item à Sheets à Item à Columns à Item
§ Application à Workbooks à ActiveSheet à Columns à Item
§ Application à ActiveWorkbook à ActiveSheet à Columns à Item
§ Application à ActiveSheet à Columns à Item
§ Application à Columns à Item
Access paths (for the currently selected cells):
§ Application à Workbooks à Item à Sheets à Item à Selection
§ Application à Workbooks à ActiveSheet à Selection
§ Application à ActiveWorkbook à ActiveSheet à Selection
§ Application à ActiveSheet à Selection
§ Application à Selection
1 Description
Range represents a specific cell range in a worksheet (Sheet). This range can contain an arbitrary number of
cells, from one cell to the whole worksheet.
You can use a Range object to get and set among other things the contents and formatting of the cells in the
represented range, to copy the range to the clipboard, etc.
2. The Sheet.Selection property returns a Range object that represents the active selection, i.e. the currently
selected cells. Example:
BasicMaker and PlanMaker 259
' Format the current selection with the font "Courier New"
pm.ActiveSheet.Selection.Font.Name = "Courier New"
3. The Rows collection returns Range objects that represent an entire row of the worksheet. You can access
the Rows collection through the Sheet.Rows object. Example:
4. The Columns collection returns Range objects that represent an entire column of the worksheet. You can
access the Columns collection through the Sheet.Columns object. Example:
No matter how you access the Range object, you can apply all the properties and methods described below.
Objects:
§ Cells ® Range
§ Range ® Range
§ Workbook ® Workbook
BasicMaker and PlanMaker 260
§ Sheet ® Sheet
§ NumberFormatting ® NumberFormatting
§ Font ® Font
§ Shading ® Shading
§ Validation ® Validation
§ Application ® Application
§ Parent ® Sheet
Collections:
§ Borders ® Borders
Methods:
§ AutoFit
§ ApplyFormatting
§ Select
§ Copy
§ Cut
§ Paste
§ Insert
§ Delete
§ Clear
§ ClearContents
§ ClearFormats
§ ClearConditionalFormatting
§ ClearComments
§ ClearInputValidation
§ AutoFilter
Parameters:
RowIndex (Type: Long) indicates the row number of the desired cell (as an offset from the top left cell
in the range).
ColumnIndex (optional; Type: Long) indicates the column number of the desired cell (as an offset from
the top left cell in the range).
Examples:
' Fill the first cell of the Range object with the value 42
pm.ActiveSheet.Range("B5:B10").Item(1, 1).Value = 42
' Change the format of the first cell of the current selection
pm.ActiveSheet.Selection.Item(1, 1).Font.Size = 24
Name (property)
Formula (property)
' Enter the same formula for the cells A1, A2, B1 and B2
pm.ActiveSheet.Range("A1:B2").Formula = "=CHAR(64)"
Note: If the formula doesn't start with "=" or "+", it will be entered as a literal value (number, string or date).
Value (property)
Value2 (property)
HorizontalAlignment (property)
VerticalAlignment (property)
WrapText (property)
LeftPadding (property)
RightPadding (property)
TopPadding (property)
BottomPadding (property)
MergeCells (property)
Orientation (property)
VerticalText (property)
PageBreakCol (property)
PageBreakRow (property)
Comment (property)
Locked (property)
FormulaHidden (property)
CellHidden (property)
Gets or sets the "Hide cell" setting, corresponding to the option of the same name on the Protection tab of the
dialog box for the cell properties.
Nonprintable (property)
Hidden (property)
Whole rows can also be addressed through the Rows collection and whole columns through the Columns
collection:
RowHeight (property)
Gets or sets the row height in points (1 point corresponds to 1/72 inches).
The specified range must contain one or more entire rows or columns. For more information, see the notes on
the Hidden property.
ColumnWidth (property)
Syntax 2:
obj = Range(Cell1, Cell2)
Parameters:
BasicMaker and PlanMaker 267
Cell1 (type: String) specifies either according to syntax 1 a cell range (then Cell2 must be omitted) or
according to syntax 2 the upper left corner of a range (then parameter Cell2 specifies the lower right
corner of the range).
Cell2 (optional; type: String) should be used only if Cell1 refers to an individual cell.
Examples for syntax 1:
Range("A1:B20") ' Cells A1 to B20
Range("A1") ' Only cell A1
Range("A:A") ' The whole column A
Range("3:3") ' The whole row 3
Range("Summer") ' Named range "Summer"
Example:
Returns the Shading object that you can use to access the shading of the cells in the range.
AutoFit (method)
Set the row(s) or column(s) to optimal height or width, respectively. Corresponds to the ribbon commands Lay-
out | Row group | Optimal height and Optimal width.
The given range must cover entire rows or columns.
Syntax:
AutoFit
Parameters:
none
Return type:
none
Examples:
pm.ActiveSheet.Range("A:C").AutoFit
ApplyFormatting (method)
Parameters:
none
Return type:
none
An example using automatic formatting:
Sub Main
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
With pm.ActiveSheet.Range("A1:C3")
.Font.Name = "Arial"
.Font.Size = 14
.Font.Bold = True
.NumberFormatting.Type = pmNumberPercentage
.NumberFormatting.Digits = 2
End With
Set pm = Nothing
End Sub
Sub Main
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
pm.ActiveWorkbook.ManualApply = True
With pm.ActiveSheet.Range("A1:C3")
.Font.Name = "Arial"
.Font.Size = 14
.Font.Bold = True
.NumberFormatting.Type = pmNumberPercentage
.NumberFormatting.Digits = 2
.ApplyFormatting
End With
pm.ActiveWorkbook.ManualApply = False
Set pm = Nothing
End Sub
Select (method)
Parameters:
Add (optional; type: Boolean): If False or omitted, the new selection replaces the existing one.
Otherwise, the new selection will be added to the old one.
Return type:
none
Examples:
Deselecting: If you would like to remove any existing selection, simply select a range consisting of only one
cell:
' Set the cell frame into cell A1 (without selecting it)
pm.ActiveSheet.Range("A1").Select
Copy (method)
Copy
Parameters:
none
Return type:
none
Cut (method)
Parameters:
none
Return type:
none
Paste (method)
Pastes the content of the clipboard to the range. If the range consists of more than one cell, the content of the
clipboard will be cut or extended so that it exactly matches the range.
Syntax:
Paste
Parameters:
none
Return type:
none
Insert (method)
Inserts an empty cell area sized equally to the range defined by Range.
PlanMaker behaves as if you had selected the range and then selected the commands of the ribbon tab Home |
Cells group | Insert.
Syntax:
Insert [Shift]
Parameters:
BasicMaker and PlanMaker 272
Shift (optional; type: Long or PmInsertShiftDirection): Indicates in which direction the existing cells
will be moved. The possible values are:
pmShiftDown = 0 ' Downwards
pmShiftToRight = 1 ' To the right
Delete (method)
Deletes all cells from the range defined by Range. The rest of the cells in the table are shifted accordingly to
fill the gap.
PlanMaker behaves as if you had selected the range and then select the commands of the ribbon tab Home |
group Cells | Delete.
Syntax:
Delete [Shift]
Parameters:
Shift (optional; type: Long or PmDeleteShiftDirection): Indicates in which direction the existing cells
will be moved. The possible values are:
pmShiftUp = 0 ' Upwards
pmShiftToLeft = 1 ' To the left
Clear (method)
Deletes all contents and formatting of all cells in the range defined by Range.
Syntax:
Clear
Parameters:
none
Return type:
none
ClearContents (method)
Deletes the contents of all cells in the range defined by Range. Their formatting is retained.
BasicMaker and PlanMaker 273
Syntax:
ClearContents
Parameters:
none
Return type:
none
ClearFormats (method)
Deletes the formatting of all cells in the range defined by Range (except for conditional formatting). Their cell
contents are retained.
Syntax:
ClearFormats
Parameters:
none
Return type:
none
ClearConditionalFormatting (method)
Deletes the conditional formatting of all cells in the range defined by Range. Their cell contents are retained.
Syntax:
ClearConditionalFormatting
Parameters:
none
Return type:
none
ClearComments (method)
Parameters:
none
BasicMaker and PlanMaker 274
Return type:
none
ClearInputValidation (method)
Parameters:
none
Return type:
none
AutoFilter (method)
Activates, deactivates or configures an AutoFilter for the range.
Syntax:
AutoFilter [Field], [Criteria1], [Operator], [Criteria2], [VisibleDropDown]
Parameters:
Note: If you do not indicate any parameter, any existing AutoFilter for the given range will be switched
off (see examples below).
Field (optional; type: Long) indicates the number of the column inside the AutoFilter area after which
want to filter the data. If you omit this parameter, the number 1 (i.e., the first column) will be assumed.
Criteria1 (optional; type: Variant) indicates the criterion of the filter – for example "red" if you want to
filter for the value "red", or ">3" to filter for values greater than three. Exception: If one of the operators
pmTop10Items, pmTop10Percent, pmBottom10Items or pmBottom10Percent is used, then Criteria1
contains a numeric value indicating how many values to display. If you omit the Criteria1 parameter, all
rows will be shown.
Operator (optional; type: Long or PmAutoFilterOperator) specifies the type of filtering:
pmAll = 0 ' Show all rows (i.e., do not filter)
pmAnd = 1 ' Criteria1 and Criteria2 must be met.
pmBottom10Items = 2 ' Only the n cells with the lowest values*
pmBottom10Percent = 3 ' Show only the bottom n percent values*
pmOr = 4 ' Criteria1 or Criteria2 must be met.
pmTop10Items = 5 ' Show only the n highest values*
pmTop10Percent = 6 ' Show only the top n percent values*
pmBlank = 7 ' Only blank rows
pmNonblank = 8 ' Only non-blank rows
Criteria2 (optional; type: Variant) allows you to specify a second filter term. This is only possible with
the operators pmAnd and pmOr.
VisibleDropDown (optional; type: Boolean) allows you to indicate whether drop-down arrows should
be shown for the filter (True) or not (False). If you omit this parameter, the value True is taken.
Return type:
none
Examples:
pm.Application.ActiveSheet.Range("A1:D10").AutoFilter 1, pmTop10Items, 5 instructs PlanMaker
to display only the first 5 items from the column A1.
If you do not specify any parameters, any existing AutoFilter for the given range will be switched off.
Example:
pm.ActiveSheet.Range("A1:D10").AutoFilter disables the above AutoFilter.
Rows (collection)
Access paths for the rows of a worksheet:
§ Application à Workbooks à Item à Sheets à Item à Rows
§ Application à Workbooks à Item à ActiveSheet à Rows
§ Application à ActiveWorkbook à ActiveSheet à Rows
§ Application à ActiveSheet à Rows
§ Application à Rows
Access paths for the rows of arbitrary ranges:
§ Application à Workbooks à Item à Sheets à Item à Range à Rows
§ Application à Workbooks à ActiveSheet à Range à Rows
§ Application à ActiveWorkbook à ActiveSheet à Range à Rows
§ Application à ActiveSheet à Range à Rows
§ Application à Range à Rows
Access paths for the rows of entire table columns:
§ Application à Workbooks à Item à Sheets à Item à Columns à Item à Rows
§ Application à Workbooks à ActiveSheet à Columns à Item à Rows
§ Application à ActiveWorkbook à ActiveSheet à Columns à Item à Rows
§ Application à ActiveSheet à Columns à Item à Rows
§ Application à Columns à Item à Rows
Access paths for the rows in the currently selected cells:
§ Application à Workbooks à Item à Sheets à Item à Selection à Rows
§ Application à Workbooks à ActiveSheet à Selection à Rows
§ Application à ActiveWorkbook à ActiveSheet à Selection à Rows
§ Application à ActiveSheet à Selection à Rows
§ Application à Selection à Rows
BasicMaker and PlanMaker 276
1 Description
Rows is a collection of all rows in a worksheet or range. The individual elements of this collection are of the
type Range, which allows you to apply all properties and methods available for Range objects to them.
Objects:
§ Item ® Range (default object)
§ Application ® Application
§ Parent ® Sheet or Range
Returns an individual Range object, i.e. a range that contains one individual row.
Which Range object you get depends on the numeric value that you pass to Item: 1 for the first row, 2 for the
second, etc.
Example:
' Set the font for the second row of the worksheet to Courier New
pm.ActiveSheet.Rows.Item(2).Font.Name = "Courier New"
Returns the parent object, i.e. an object that is either of the type Sheet or Range .
Columns (collection)
Access paths for the columns of a worksheet:
§ Application à Workbooks à Item à Sheets à Item à Columns
§ Application à Workbooks à Item à ActiveSheet à Columns
§ Application à ActiveWorkbook à ActiveSheet à Columns
§ Application à ActiveSheet à Columns
§ Application à Columns
Access paths for the columns of arbitrary ranges:
§ Application à Workbooks à Item à Sheets à Item à Range à Columns
§ Application à Workbooks à ActiveSheet à Range à Columns
§ Application à ActiveWorkbook à ActiveSheet à Range à Columns
§ Application à ActiveSheet à Range à Columns
§ Application à Range à Columns
Access paths for the columns of entire table columns:
§ Application à Workbooks à Item à Sheets à Item à Rows à Item à Columns
§ Application à Workbooks à ActiveSheet à Rows à Item à Columns
§ Application à ActiveWorkbook à ActiveSheet à Rowsà Item à Columns
§ Application à ActiveSheet à Rowsà Item à Columns
§ Application à Rowsà Item à Columns
Access paths for the columns in the currently selected cells:
§ Application à Workbooks à Item à Sheets à Item à Selection à Columns
§ Application à Workbooks à ActiveSheet à Selection à Columns
§ Application à ActiveWorkbook à ActiveSheet à Selection à Columns
§ Application à ActiveSheet à Selection à Columns
§ Application à Selection à Columns
BasicMaker and PlanMaker 278
1 Description
Columns is a collection of all columns in a worksheet or range. The individual elements of this collection are
of the type Range, which allows you to apply all properties and methods available for Range objects to them.
Objects:
§ Item ® Range (default object)
§ Application ® Application
§ Parent ® Sheet or Range
Returns an individual Range object, i.e. a range that contains one individual column.
Which Range object you get depends on the numeric value that you pass to Item: 1 for the first column, 2 for
the second, etc.
Example:
' Set the font for second column in the worksheet to Courier New
pm.ActiveSheet.Columns.Item(2).Font.Name = "Courier New"
Returns the parent object, i.e. an object that is either of the type Sheet or Range .
NumberFormatting (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à Range à NumberFormatting
§ Application à Workbooks à ActiveSheet à Range à NumberFormatting
§ Application à ActiveWorkbook à ActiveSheet à Range à NumberFormatting
§ Application à ActiveSheet à Range à NumberFormatting
Instead of "Range", you can also use other objects and properties that return a Range-object: ActiveCell, Selection, Rows(n), Columns(n) and Cells(x,
y). You can find examples of these access paths in the Range-Object.
1 Description
You can use the NumberFormatting object to read and change the number format of a range (corresponding to
the options on the Number format tab in the dialog box for the cell properties).
§ Currency
§ Accounting
§ Digits
§ NegativeRed
§ SuppressMinus
§ SuppressZeros
§ ThousandsSeparator
Objects:
§ Application ® Application
§ Parent ® Range
Type (property)
Data type: Long (PmNumberFormatting)
Gets or sets the number format for the cells in the range. The possible values are:
DateFormat (property)
For details on the format codes supported, see the online help for PlanMaker, keyword "User-defined number
formats".
Note: The letter codes for the components of a date format are language-specific. If PlanMaker is running with
its English user interface, e.g. DD/MM/YYYY is a valid date format. If the German user interface is used,
TT.MM.JJJJ has to be used, with the French user interface it has to be JJ.MM.AAAA, etc.
If you would like to retrieve the date string used in a cell, you must first check if the cell is formatted as a date
at all – otherwise this property fails:
BasicMaker and PlanMaker 281
CustomFormat (property)
Currency (property)
EUR Euro
USD US dollar
CAD Canadian dollar
AUD Australian dollar
JPY Japanese yen
RUB Russian ruble
CHF Swiss franc
You can find a complete list of ISO codes (PlanMaker supports many of them, but not all) in the following
Wikipedia article: http://en.wikipedia.org/wiki/ISO_4217
Example:
To retrieve the currency string used in a cell, you must first check if the cell is formatted as a currency at all –
otherwise this property fails:
End With
Accounting (property)
' Format cell A1 in the accounting format with the currency "euro"
pm.ActiveSheet.Range("A1").NumberFormatting.Accounting = "EUR"
To retrieve the currency string used in a cell, you must first check if the cell is formatted in Accounting number
format at all – otherwise this property fails:
Digits (property)
You can also use this property with the number format "Fraction" (pmNumberFraction), but in this case it sets
the denominator of the fraction:
BasicMaker and PlanMaker 283
For the number format "fraction" Digits may be between 0 and 1000, for all other number formats between 0
and 15.
NegativeRed (property)
SuppressMinus (property)
SuppressZeros (property)
ThousandsSeparator (property)
Sub Main
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
With pm.ActiveSheet.Range("A1:C3")
.NumberFormatting.Type = pmNumberPercentage
.NumberFormatting.Digits = 2
End With
Set pm = Nothing
End Sub
Font (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à Range à Font
§ Application à Workbooks à ActiveSheet à Range à Font
§ Application à ActiveWorkbook à ActiveSheet à Range à Font
§ Application à ActiveSheet à Range à Font
Instead of "Range", you can also use other objects and properties that return a Range-object: ActiveCell, Selection, Rows(n), Columns(n) and Cells(x,
y). You can find examples of these access paths in the Range-Object.
1 Description
The Font object describes the character formatting (font, text color, underline, etc.) of cells.
§ Size
§ Bold
§ Italic
§ Underline
§ StrikeThrough
§ Superscript
§ Subscript
§ AllCaps
§ SmallCaps
§ PreferredSmallCaps
§ Blink
§ Color
§ ColorIndex
§ BColor
§ BColorIndex
§ Spacing
§ Pitch
Objects:
§ Application ® Application
§ Parent ® Range
Name (property)
Data type: String
Gets or sets the font name (as a string).
If the cells are formatted in different typefaces, an empty string will be returned.
Size (property)
' Set the font size of the currently selected cells to 10.3 pt
pm.ActiveSheet.Selection.Font.Size = 10.3
Bold (property)
§ smoUndefined (only when reading): The cells are partly bold and partly not.
Italic (property)
Underline (property)
When you read this property and the cells are partly underlined and partly not, smoUndefined is returned.
StrikeThrough (property)
Superscript (property)
Subscript (property)
AllCaps (property)
SmallCaps (property)
PreferredSmallCaps (property)
' Format the current cell in small capitals with 75% of size
pm.ActiveCell.Font.PreferredSmallCaps = 75
Blink (property)
Color (property)
ColorIndex (property)
BColor (property)
BColorIndex (property)
Gets or sets the background color of text as an index color. "Index colors" are the standard colors of PlanMaker,
consecutively numbered from 0 for black to 15 for light gray. You may use the values shown in the Index colors
table.
If the cells are formatted in different colors or in a color that is not an index color, the constant smoUndefined
will be returned when you read this property.
Note: It is recommended to use the BColor property (see above) instead of this one, since it is not limited to the
standard colors but enables you to access the entire BGR color palette.
Spacing (property)
Pitch (property)
Sub Main
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
BasicMaker and PlanMaker 290
With pm.ActiveSheet.Range("A1:C3")
.Font.Name = "Times New Roman"
.Font.Size = 24
.Font.Bold = True
End With
Set pm = Nothing
End Sub
Borders (collection)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à Range à Borders
§ Application à Workbooks à ActiveSheet à Range à Borders
§ Application à ActiveWorkbook à ActiveSheet à Range à Borders
§ Application à ActiveSheet à Range à Borders
Instead of "Range", you can also use other objects and properties that return a Range-object: ActiveCell, Selection, Rows(n), Columns(n) and Cells(x,
y). You can find examples of these access paths in the Range-Object.
1 Description
The Borders collection represents the four border lines of cells (left, right, top and bottom). You can use this
collection to get or change the line settings (thickness, color, etc.) of each border line.
The individual elements of the Borders collection are of the type Border.
The parameter you pass to the Borders collection is the number of the border line you want to access:
Example:
Objects:
§ Item ® Border (default object)
§ Application ® Application
§ Parent ® Range
Sub Main
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
With pm.ActiveSheet.Range("B2:D4")
.Borders(pmBorderLeft).Type = pmLineStyleSingle
.Borders(pmBorderLeft).Thick1 = 4
.Borders(pmBorderLeft).Color = pmColorBlue
.Borders(pmBorderRight).Type = pmLineStyleDouble
.Borders(pmBorderRight).Thick1 = 1
.Borders(pmBorderRight).Thick2 = 1
.Borders(pmBorderRight).Color = smoColorRed
End With
Set pm = Nothing
End Sub
Border (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à Range à Borders à Item
§ Application à Workbooks à ActiveSheet à Range à Borders à Item
§ Application à ActiveWorkbook à ActiveSheet à Range à Borders à Item
§ Application à ActiveSheet à Range à Borders à Item
Instead of "Range", you can also use other objects and properties that return a Range-object: ActiveCell, Selection, Rows(n), Columns(n) and Cells(x,
y). You can find examples of these access paths in the Range-Object.
1 Description
A Border object represents one of the border lines of cells (e.g. the upper, lower, left or right line). You can use
this object to get or change the line settings (thickness, color, etc.) of a border line.
Example:
Objects:
§ Application ® Application
§ Parent ® Borders
Type (property)
Data type: Long (PmLineStyle)
Gets or sets the type of the border line. The possible values are:
Thick1 (property)
Thick2 (property)
Separator (property)
Color (property)
ColorIndex (property)
Shading (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à Range à Shading
§ Application à Workbooks à ActiveSheet à Range à Shading
§ Application à ActiveWorkbook à ActiveSheet à Range à Shading
BasicMaker and PlanMaker 295
1 Description
The Shading object represents the shading of cells (with either a shading or a pattern).
Objects:
§ Application ® Application
§ Parent ® Range
Texture (property)
smoPatternRightDiagFine = 8
smoPatternLeftDiagFine = 9
smoPatternHashDiagFine = 10
smoPatternVertFine = 11
smoPatternHorzFine = 12
smoPatternHashFine = 13
To add a shading, set the Texture property to smoPatternHalftone and specify the required intensity of
shading with the Intensity property.
To add a pattern, set the Texture property to one of the values between smoPatternRightDiagCoarse and
smoPatternHashFine.
To remove an existing shading or pattern, set the Texture property to smoPatternNone.
Intensity (property)
ForegroundPatternColor (property)
ForegroundPatternColorIndex (property)
BackgroundPatternColor (property)
Gets or sets the background color for the shading or pattern as a "BGR" value (Blue-Green-Red triplet). You
can either indicate an arbitrary value or use one of the pre-defined BGR color constants.
BackgroundPatternColorIndex (property)
Sub Main
Dim pm as Object
Set pm = CreateObject("PlanMaker.Application")
pm.Visible = True
With pm.ActiveSheet.Range("A1:C3")
.Shading.Intensity = 50
.Shading.ForegroundPatternColor = smoColorRed
End With
Set pm = Nothing
End Sub
Validation (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à Range à Validation
BasicMaker and PlanMaker 298
1 Description
The Validation object represents the validation check of a range (that is, a Range object). In PlanMaker, such
validation checks can be set up with the ribbon command Review | Input validation.
Objects:
§ Application ® Application
§ Parent ® Range
Methods:
§ Add
§ Modify
§ Delete
Gets or sets the setting which type of values to allow. The possible values are:
AlertStyle (property)
ShowInput (property)
InputTitle (property)
InputMessage (property)
ShowError (property)
ErrorTitle (property)
ErrorMessage (property)
Returns the maximum of the validity check for the operators pmDVBetween and pmDVNotBetween, for all
other operators the return value is empty.
InCellDropDown (property)
IgnoreBlank (property)
Add (method)
Sets up a new validity check in an area. Corresponds to the ribbon command Check | Validation.
Please note that each cell cannot have more than one input validation check.
Syntax:
Add Type, [AlertStyle], [Operator], [Formula1], [Formula2]
Parameters:
Type (type: Long or PmDVType) determines the type of input validation check. The possible values
are:
pmValidateInputOnly = 0 ' Allow all types of values *
pmValidateWholeNumber = 1 ' Allow only integer numbers
pmValidateDecimal = 2 ' Allow only decimal numbers
pmValidateList = 3 ' Allow only values from a pre-defined list **
pmValidateDate = 4 ' Allow only date values
pmValidateTime = 5 ' Allow only times values
BasicMaker and PlanMaker 302
* With this setting, all values are accepted. Use it if you merely want an input message to appear when
the user activates the affected cell(s).
** With this setting, only the values specified in a list of allowed values are accepted. Use the parameter
Formula1 to specify the range containing this list. For example, if the cells C1 through C3 hold the
values "dog", "cat" and "mouse" and you enter C1:C3 for Formula1, only these three values will be
allowed.
*** When using this setting, you must specify in Formula1 an expression that returns True for valid
entries, or False for invalid entries.
AlertStyle (type: Long or PmDVAlertStyle) specifies the style of the error message for invalid values:
pmValidAlertStop = 0 ' Error message
pmValidAlertWarning = 1 ' Warning message
pmValidAlertInformation = 2 ' Information message
Operator (type: Long or PmDVOperator) specifies the comparison operator used by the input
validation check:
pmDVBetween = 0 ' is between
pmDVNotBetween = 1 ' is not between
pmDVEqual = 2 ' is equal to
pmDVNotEqual = 3 ' is not equal to
pmDVGreater = 4 ' is greater than
pmDVLess = 5 ' is less than
pmDVGreaterEqual = 6 ' is greater than or equal to
pmDVLessEqual = 7 ' is less than or equal to
Formula1 (optional; type: String ) defines a string containing a number, a reference to a cell, or a
formula. For pmDVBetween and pmDVNotBetween it specifies the minimum, for all other operators
the value.
Formula2 (optional; type: String ) defines a string containing a number, a reference to a cell, or a
formula. Must be specified only if pmDVBetween or pmDVNotBetween are used.
Return type:
none
pmValidateWholeNumber, All of the above Contains the minimum for May only be used with
pmValidateDecimal, pmDVBetween and pmDVBetween and
pmValidateDate, pmDVNotBetween and the pmDVNotBetween and
pmValidateTime, value for all other then contains the maximum.
pmValidateTextLength operators.
BasicMaker and PlanMaker 303
Modify (method)
Parameters:
Type (type: Long or PmDVType) determines the type of input validation check. The possible values
are:
pmValidateInputOnly = 0 ' Allow all types of values *
pmValidateWholeNumber = 1 ' Allow only integer numbers
pmValidateDecimal = 2 ' Allow only decimal numbers
pmValidateList = 3 ' Allow only values from a pre-defined list **
pmValidateDate = 4 ' Allow only date values
pmValidateTime = 5 ' Allow only times values
pmValidateTextLength = 6 ' Allow only values of a certain length
pmValidateCustom = 7 ' User-defined check ***
* With this setting, all values are accepted. Use it if you merely want an input message to appear when
the user activates the affected cell(s).
** With this setting, only the values specified in a list of allowed values are accepted. Use the parameter
Formula1 to specify the range containing this list. For example, if the cells C1 through C3 hold the
values "dog", "cat" and "mouse" and you enter C1:C3 for Formula1, only these three values will be
allowed.
*** When using this setting, you must specify in Formula1 an expression that returns True for valid
entries, or False for invalid entries.
AlertStyle (type: Long or PmDVAlertStyle) specifies the style of the error message for invalid values:
pmValidAlertStop = 0 ' Error message
pmValidAlertWarning = 1 ' Warning message
pmValidAlertInformation = 2 ' Information message
Operator (type: Long or PmDVOperator) specifies the relational operator used by the input validation
check:
pmDVBetween = 0 ' is between
pmDVNotBetween = 1 ' is not between
pmDVEqual = 2 ' is equal to
pmDVNotEqual = 3 ' is not equal to
pmDVGreater = 4 ' is greater than
BasicMaker and PlanMaker 304
Formula1 (optional; type: String ) defines a string containing a number, a reference to a cell, or a
formula. For pmDVBetween and pmDVNotBetween it specifies the minimum, for all other operators
the value.
Formula2 (optional; type: String ) defines a string containing a number, a reference to a cell, or a
formula. Must be specified only if pmDVBetween or pmDVNotBetween are used.
Return type:
none
Delete (method)
Parameters:
none
Return type:
none
Example:
AutoFilter (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à AutoFilter
§ Application à Workbooks à ActiveSheet à AutoFilter
§ Application à ActiveWorkbook à ActiveSheet à AutoFilter
§ Application à ActiveSheet à AutoFilter
1 Description
The AutoFilter object allows you to access the AutoFilter of a worksheet. In PlanMaker, such filters can be set
with the ribbon command Data | Filter group | AutoFilter.
BasicMaker and PlanMaker 305
Collections:
§ Filters ® Filters
Filters (collection)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à AutoFilter à Filters
§ Application à Workbooks à ActiveSheet à AutoFilter à Filters
§ Application à ActiveWorkbook à ActiveSheet à AutoFilter à Filters
§ Application à ActiveSheet à AutoFilter à Filters
BasicMaker and PlanMaker 306
1 Description
The Filters collection contains all columns of the currently active AutoFilter.
The individual elements of this collection are of the type Filter. You can use the individual Filter objectsto
query the selection criteria and operators of individual columns of the AutoFilter.
Objects:
§ Item ® Filter (default object)
§ Application ® Application
§ Parent ® AutoFilter
Filter (object)
Access paths:
§ Application à Workbooks à Item à Sheets à Item à AutoFilter à Filters à Item
§ Application à Workbooks à ActiveSheet à AutoFilter à Filters à Item
§ Application à ActiveWorkbook à ActiveSheet à AutoFilter à Filters à Item
§ Application à ActiveSheet à AutoFilter à Filters à Item
1 Description
A Filter object represents one individual column in the active AutoFilter. You can use it to retrieve the criteria
and filter conditions for the respective column.
' Display the criterion for the first column of the AutoFilter
MsgBox pm.ActiveSheet.AutoFilter.Filters.Item(1).Criteria1
Please note that all properties of the Filter object are read-only. To set up a new AutoFilter, use the AutoFilter
method in the Range object.
Objects:
§ Application ® Application
§ Parent ® Filters
BasicMaker and PlanMaker 308
Windows (collection)
Access path: Application à Windows
1 Description
The Windows collection contains all open document windows. The individual elements of this collection are of
the type Window.
Objects:
§ Item ® Window (default object)
§ Application ® Application
§ Parent ® Application
' Show the name of the document window "Test.tmdx" (if currently open)
MsgBox pm.Application.Windows.Item("Test.pmdx").FullName
' You can also use the full name with path
MsgBox pm.Application.Windows.Item("c:\Documents\Test.pmdx").FullName
Window (object)
Access paths:
§ Application à Windows à Item
§ Application à ActiveWindow
§ Application à Workbooks à Item à ActiveWindow
§ Application à ActiveWorkbook à ActiveWindow
1 Description
A Window object represents one individual document window that is currently open in PlanMaker.
An individual Window object exists for each document window. If you open or close document windows, the
respective Window objects will be created or deleted dynamically.
§ You can access the currently active document window through Application.ActiveWindow:
§ The object Workbook contains an object pointer to the respective document window:
' Access the active document window through the active document
MsgBox pm.Application.ActiveWorkbook.ActiveWindow.Name
Objects:
§ Workbook ® Workbook
§ ActiveCell ® Range
§ ActiveSheet ® Sheet
§ Application ® Application
§ Parent ® Windows
Methods:
§ Activate
§ Close
Left (property)
Top (property)
Width (property)
Height (property)
WindowState (property)
DisplayFormulas (property)
DisplayVerticalScrollBar (property)
DisplayHorizontalScrollBar (property)
DisplayWorkbookTabs (property)
DisplayHeadings (property)
Zoom (property)
Example:
Note: Changes to this setting affect only the current worksheet. If you want to change the zoom level of other
worksheets as well, you have to make them the active worksheet first.
DisplayGridlines (property)
GridlineColor (property)
GridlineColorIndex (property)
§ This property is supported by PlanMaker only for Excel compatibility reasons. It is recommended to use the
identically named property in the Sheet object instead, as it allows you to change this setting for each
worksheet individually.
§ If you retrieve this property while multiple worksheets exist where this setting has different values, the value
smoUndefined will be returned.
Activate (method)
Brings the document window to the foreground (if the property Visible for this document is True) and sets the
focus to it.
BasicMaker and PlanMaker 316
Syntax:
Activate
Parameters:
none
Return type:
none
Example:
Close (method)
Parameters:
SaveChanges (optional; type: Long or SmoSaveOptions) indicates whether the document opened in the
window should be saved or not (if it was changed since last save). If you omit this parameter, the user
will be asked to indicate it (if necessary). The possible values for SaveChanges are:
smoDoNotSaveChanges = 0 ' Don't ask, don't save
smoPromptToSaveChanges = 1 ' Ask the user
smoSaveChanges = 2 ' Save without asking
Return type:
none
Example:
RecentFiles (collection)
Access path: Application à RecentFiles
1 Description
RecentFiles is a collection of all recently opened files listed in the File menu. The individual elements of this
collection are of the type RecentFile.
BasicMaker and PlanMaker 317
' Show the name of the first recent file in the File menu
MsgBox pm.Application.RecentFiles.Item(1).Name
Objects:
§ Item ® RecentFile (default object)
§ Application ® Application
§ Parent ® Application
Methods:
§ Add
Add (method)
Adds a document to the list of recently opened files.
Syntax:
Add Document, [FileFormat]
Parameters:
Document is a string containing the file path and name of the document to be added.
FileFormat (optional; type: Long or PmSaveFormat) specifies the file format of the document to be
added. The possible values are:
pmFormatDocument = 0 ' PlanMaker document
pmFormatTemplate = 1 ' PlanMaker document template
pmFormatExcel97 = 2 ' Excel 97/2000/XP
pmFormatExcel5 = 3 ' Excel 5.0/7.0
pmFormatExcelTemplate = 4 ' Excel document template
pmFormatSYLK = 5 ' Sylk
pmFormatRTF = 6 ' Rich Text Format
pmFormatTextMaker = 7 ' TextMaker (= RTF)
pmFormatHTML = 8 ' HTML document
pmFormatdBaseDOS = 9 ' dBASE database with DOS character set
pmFormatdBaseAnsi = 10 ' dBASE database with Windows character set
pmFormatDIF = 11 ' Text file with Windows character set
pmFormatPlainTextAnsi = 12 ' Text file with Windows character set
pmFormatPlainTextDOS = 13 ' Text file with DOS character set
pmFormatPlainTextUnix = 14 ' Text file with ANSI character set for UNIX,
Linux, FreeBSD
pmFormatPlainTextUnicode = 15 ' Text file with Unicode character set
pmFormatdBaseUnicode = 18 ' dBASE database with Unicode character set
pmFormatPlainTextUTF8 = 21 ' Text file with UTF8 character set
pmFormatMSXML = 23 ' Excel 2007 and later
pmFormatMSXMLTemplate = 24 ' Excel document template 2007 and later
pmFormatPM2008 = 26 ' PlanMaker 2008 document
pmFormatPM2010 = 27 ' PlanMaker 2010 document
pmFormatPM2012 = 28 ' PlanMaker 2012 document
pmFormatPM2012Template = 29 ' PlanMaker 2012 document template
Tip: Independent of the value for the FileFormat parameter PlanMaker always tries to determine the file
format by itself and ignores evidently false inputs.
Return type:
Object (a RecentFile object which represents the added document)
Example:
' Do the same, but evaluate the return value (mind the parentheses!)
Dim fileObj as Object
Set fileObj = pm.Application.RecentFiles.Add("Test.pmdx")
MsgBox fileObj.Name
RecentFile (object)
Access path: Application à RecentFiles à Item
1 Description
A RecentFile object represents one individual of the recently opened files. You can use it to retrieve the
properties of such a file and to open it again.
An individual RecentFile object exists for each recently opened file. For each document that you open or close,
the list of these files in the File menu will change accordingly – i.e., the respective RecentFile objects will be
created or deleted dynamically.
' Show the name of the first file in the File menu
MsgBox pm.Application.RecentFiles.Item(1).Name
Objects:
§ Application ® Application
BasicMaker and PlanMaker 320
§ Parent ® RecentFiles
Methods:
§ Open
Open (method)
Opens the appropriate document and returns the Workbook object for it.
Syntax:
Open
Parameters:
none
Return type:
Workbook
BasicMaker and PlanMaker 321
Example:
' Open the first recent file displayed in the File menu
pm.Application.RecentFiles(1).Open
FontNames (collection)
Access path: Application à FontNames
1 Description
FontNames is a collection of all fonts installed in Windows. The individual elements of this collection are of
the type FontName.
Objects:
§ Item ® FontName (default object)
§ Application ® Application
§ Parent ® Application
FontName (object)
Access path: Application à FontNames à Item
1 Description
A FontName object represents one individual font of the fonts installed in Windows. An individual FontName
object exists for each installed font.
Objects:
§ Application ® Application
§ Parent ® FontNames
#include (statement)
#include "[Path\]FileName"
Embeds a file with Basic statements into the current script – as if the file's content was inserted at the place
where the #include statement resides.
For example, you can create a file that contains the definitions of some constants or dialogs that you want to
reuse in multiple scripts.
Note: You can omit the file path if the file to embed resides in the same folder.
Examples:
#include "code_snippet.bas"
#include "c:\scripts\code_snippet.bas"
Abs (function)
Abs(Num)
Returns the absolute value of the numeric value Num, i.e., removes its sign. If Num is zero, Abs returns zero.
The type of the return value corresponds to the type of the passed parameter Num. Exception: If Num is a
Variant of VarType 8 (String) and can be converted to a number, the result will have the type Variant of
VarType 5 (Double).
See also: Sgn
Example:
Sub Main
Dim Msg, x, y
x = InputBox("Enter a number:")
y = Abs(x)
Msg = "The absolute value of " & x & " is: " & y
MsgBox Msg
End Sub
Statements and functions from A to Z 326
AppActivate (statement)
AppActivate "Title"
Activates an already running application, i.e., brings the application window to the front and sets the focus to
the application.
The string Title is the application name as it appears in the title bar.
See also: AppPlanMaker, AppTextMaker, CreateObject, GetObject, Shell
Example:
Sub Main
X = Shell("Calc.exe", 1) ' Invoke the Calculator application
For i = 1 To 5
SendKeys i & "{+}", True ' Send keystrokes
Next i
Msg = "The calculator will be closed now."
MsgBox Msg
AppActivate "Calculator" ' Set the focus to the calculator
SendKeys "%{F4}", True ' Send Alt+F4 to close the application
End Sub
AppPlanMaker (function)
AppPlanMaker ["Command-line parameters"]
To ensure that this command does not fail, PlanMaker must be registered in the Windows Registry. If this is not
the case, it is sufficient just to start PlanMaker once conventionally. The program will then automatically
update its settings in the Registry.
Note: This command simply starts the PlanMaker application without establishing an OLE Automation
connection. In order to make an OLE Automation connection to PlanMaker, use the GetObject function
after invoking AppPlanMaker. Alternatively, you can use the CreateObject function instead of the
AppPlanMaker function from the outset. In this case, PlanMaker will be launched and an OLE Automation
connection will be established at the same time.
Statements and functions from A to Z 327
AppSoftMakerPresentations (function)
AppSoftMakerPresentations ["Command-line parameters"]
To ensure that this command does not fail, Presentations must be registered in the Windows Registry. If this is
not the case, it is sufficient just to start Presentations once conventionally. The program will then automatically
update its settings in the Registry.
See also: AppTextMaker, CreateObject, GetObject, Shell
AppTextMaker (function)
AppTextMaker ["Command-line parameters"]
To ensure that this command does not fail, TextMaker must be registered in the Windows Registry. If this is not
the case, it is sufficient just to start TextMaker once conventionally. The program will then automatically
update its settings in the Registry.
Note: This command simply starts the TextMaker application without establishing an OLE Automation
connection. In order to make an OLE Automation connection to TextMaker, use the function GetObject
after invoking AppTextMaker. Alternatively, you can use the CreateObject function instead of the
AppTextMaker function from the outset. In this case, TextMaker will be launched and an OLE Automation
connection will be established at the same time.
Asc (function)
Asc(Str)
Returns the character code of the first letter in a string according to the Unicode character table (UCS-2).
The result is an integer value between 0 and 32767.
See also: Chr
Example:
Sub Main
Dim i, Msg
For i = Asc("A") To Asc("Z")
Msg = Msg & Chr(i)
Next i
MsgBox Msg
End Sub
Atn (function)
Atn(Num)
Beep (statement)
Beep
Is used to define a custom dialog box. See the section Dialog definition.
General information about creating custom dialog boxes can be found in the section Dialog boxes.
Call (statement)
Call Name [(Parameters)]
Or:
Name [Parameters]
Executes the Sub or Function procedure or DLL function with the name Name.
Parameters is a comma-separated list of parameters which can be passed to the procedure.
Statements and functions from A to Z 330
The keyword Call is usually omitted. If it is used, the parameter list must be enclosed in parentheses, otherwise
parentheses may not be used.
Call Name(Parameter1, Parameter2 ...) has therefore the same meaning as Name Parameter1, Parameter2 ...
Functions can also be invoked using the Call statement; however their return value will be lost.
See also: Declare, Function, Sub
Example:
Sub Main
Call Beep
End Sub
CDbl (function)
CDbl(Expression)
Converts an expression to the Double data type. The parameter Expression must be a number or a string.
See also: CInt, CLng, CSng, CStr
Example:
Sub Main
Dim y As Integer
y = 25
If VarType(y) = 2 Then
Print y
x = CDbl(y)
Print x
End If
End Sub
ChDir (statement)
ChDir [Drive:]Folder
Example:
Sub Main
Dim Answer, Msg, NL
NL = Chr(10) ' Chr(10)=New line
CurPath = CurDir() ' Determine current path
ChDir "\"
Msg = "The folder was changed to " & CurDir() & "."
Msg = Msg & NL & NL & "Click on OK "
Msg = Msg & "to return to the previous folder."
Answer = MsgBox(Msg)
ChDir CurPath ' Back to the old folder
Msg = "We are now back to the folder " & CurPath & "."
MsgBox Msg
End Sub
ChDrive (statement)
ChDrive Drive
Chr (function)
Chr(Num)
Returns the character associated with the specified character code from the Unicode character table (UCS-2).
The parameter Num can take an integer value between 0 and 32767.
See also: Asc
Example:
Sub Main
Dim i, Msg
For i = Asc("A") To Asc("Z")
Msg = Msg & Chr(i)
Next i
MsgBox Msg
End Sub
CInt (function)
CInt(Expression)
CLng (function)
CLng(Expression)
Close (statement)
Close [[#]FileNumber]
Next i
' Close all files
Close
End Sub
Const (statement)
Const Name = Expression
Cos (function)
Cos(Num)
CreateObject (function)
CreateObject(Class)
When you invoke this function and the respective application is not already running, it will launch
automatically.
As soon as the object has been created, its methods and properties can be accessed using dot notation – for
example:
tm.Visible = True ' makes TextMaker's application window visible
CSng (function)
CSng(Expression)
CStr (function)
CStr(Expression)
CurDir (function)
CurDir(Drive)
Date (function)
Date [()]
End Sub
DateSerial (function)
DateSerial(Year, Month, Day)
Returns a Variant variable (type: date) corresponding to the parameters Year, Month and Day.
See also: DateValue, Day, Month, Now, Time, TimeSerial, TimeValue, Weekday, Year
Example:
Sub Main
Print DateSerial(2020,09,25) ' returns 2020-09-25
End Sub
DateValue (function)
DateValue(DateExpression)
Returns a Variant variable (type: date) corresponding to the specified date expression. DateExpression can be a
string or any expression that represents a date, a time, or both a date and a time.
See also: DateSerial, Day, Month, Now, Time, TimeSerial, TimeValue, Weekday, Year
Example:
Sub Main
Print DateValue("25. September 2020") ' returns 2020-09-25
End Sub
Day (function)
Day(Expression)
Returns the day of the month for the given date expressed as an integer value.
Expression is a numeric or string expression which represents a date.
See also: Date, Hour, Minute, Month, Now, Second, Time, Weekday, Year
Example:
Sub Main
T1 = Now ' Now = current date + time
Statements and functions from A to Z 338
MsgBox T1
MsgBox "Day: " & Day(T1)
MsgBox "Month: " & Month(T1)
MsgBox "Year: " & Year(T1)
MsgBox "Hours: " & Hour(T1)
MsgBox "Minutes: " & Minute(T1)
MsgBox "Seconds: " & Second(T1)
End Sub
Declare (statement)
Declare Sub Name Lib LibName$ [Alias AliasName$] [(Parameters)]
Or:
Declare Function Name Lib LibName$ [Alias AliasName$] [(Parameters)] [As Type]
Declaring parameters
[ByVal | ByRef] Variable [As Type]
The keywords ByVal or ByRef (default value) are used to indicate whether the parameter is passed by value or
by reference (see the section Passing parameters via ByRef or ByVal).
Type specifies the data type (String, Integer, Double, Long, Variant). Alternatively, the type can be indicated
by appending a type suffix (e.g. % for Integer) to the variable name (see the section Data types).
See also: Call, section Calling functions in DLLs
Statements and functions from A to Z 339
Dialog (function)
Dialog(Dlg)
Dim (statement)
Dim Name [(Subscripts)][As Type] [, ...]
is identical to:
Statements and functions from A to Z 341
Dim Value%
If neither a data type nor a type suffix is given, a Variant variable will be created.
See also: Option Base, ReDim, section Variables
Example:
Sub Main
Dim a As Integer ' (alternatively: Dim a%)
Dim b As Long
Dim c As Single
Dim d As Double
Dim e As String
Dim f As Variant ' (alternatively: Dim f)
Dim g(10,10) As Integer ' Array of variables
.
.
.
DlgEnable (statement)
DlgEnable "Name" [, State]
Enables or disables a dialog control in a custom dialog box. A disabled dialog control is shown in gray. It
cannot be changed by the user.
This statement can be invoked from inside dialog functions.
The string Name is the name of the dialog control in the dialog box.
If State = 0, the dialog control will be disabled; for all other values of State it will be enabled. If State is not
specified, the state of the dialog control will be toggled.
See also: DlgText, DlgVisible, section Dialog boxes
Example:
If ControlID$ = "Chk1" Then
DlgEnable "Group", 1
DlgVisible "Chk2"
DlgVisible "History"
End If
DlgText (statement)
DlgText "Name", Text
DlgVisible (statement)
DlgVisible "Name", [Value]
Or:
Do
[Statements]
[Exit Do]
Statements and functions from A to Z 343
[Statements]
Loop [{While|Until} Condition]
Executes a group of statements repeatedly as long as a condition is true (Do ... While) or until a condition
becomes true (Do ... Until). See also the section Flow control.
See also: While Wend, section Flow control
Example:
Sub Main
Dim Value, Msg
Do
Value = InputBox("Enter a number between 5 and 10.")
If Value >= 5 And Value <= 10 Then
Exit Do ' Number is OK -> Exit
Else
Beep ' Number is not OK -> try once more
End If
Loop
End Sub
End (statement)
End [{Function|If|Sub}]
EOF (function)
EOF(FileNumber)
Erase (statement)
Erase ArrayName [, ...]
Exit (statement)
Exit {Do|For|Function|Sub}
Exp (function)
Exp(Number)
FileCopy (statement)
FileCopy SourceFile, TargetFile
FileLen (function)
FileLen(FileName)
Returns the size of the specified file in bytes (as a Long Integer).
The parameter FileName must be a string with the desired file name. Wildcard characters such as "*" or "?" are
not allowed.
Fix (function)
Fix(Num)
Format (function)
Format(Expression [,Format])
Returns a string consisting of the Expression parameter formatted according to the chosen formatting
instructions.
The desired format is specified using the string parameter Format. You can choose from several predefined
formats that are listed on the pages that follow. Additionally, more precise formatting can be achieved using
user-defined formats.
If the parameter Format is empty and Expression is a number, the Format function will return the same result
as the Str function, with the exception that Format does not prepend a space character to positive numbers.
For numeric formats, Expression must be a numeric expression; for string formats it must be a string.
For date/time formats, Expression must be a string with the same structure as returned by the Now function.
See also: Str, sections Numeric formats of the Format function, Date/time formats of the Format function and
String formats of the format Function
Example:
Sub Main
MsgBox Format(Date, "long date")
MsgBox Format(Date, "dd.mm.yy")
End Sub
Fixed Output with at least one digit to the left and exactly two digits to the right of the decimal
separator.
Standard Output with at least one digit to the left and exactly two digits to the right of the decimal
separator; additionally, the thousands separator is used for numbers >= 1000.
Percent Output with at least one digit to the left and exactly two digits to the right of the decimal
separator; additionally, the number is multiplied by 100 and a percent sign is appended.
Scientific Output with at least one digit to the left and exactly two digits to the right of the decimal
separator using scientific notation (exponential notation).
If the number to be formatted has a digit in the position where Format has "0", this digit is
output, otherwise 0 is output. If the number to be formatted has fewer digits to the left and to the
right of the decimal separator than the number of "0" defined in the Format, leading or trailing
zeros are displayed. If the number to be formatted has more digits to the right of the decimal
separator than the number of "0" defined in Format, the number will be rounded to the
corresponding number of digits. If the number to be formatted has more digits to the left of the
decimal separator than the number of "0" defined in Format, the extra digits will always be
output.
If the number to be formatted has a digit in the position of "#" in Format, this digit is output,
otherwise nothing is displayed.
. Decimal separator
% Percent sign. Causes a percent sign (%) to be output; furthermore, the expression is multiplied by
100.
, Thousands separator. If the number >= 1000, this sign is inserted between the thousands and the
hundreds.
E- E+ e- e+ Scientific format. If Format has at least one digit placeholder (0 or #) to the right of E-, E+, e-,
or e+, the number is formatted using a scientific format. This is achieved by inserting an E or e
between the mantissa and the exponent. The number of digit placeholders to its right defines the
number of digits in the exponent. In case of E+/e+, the exponent is always output with its sign, in
case of E-/e- notation the sign is only output if the exponent is negative.
Statements and functions from A to Z 350
: Time separator. The actual character that is output is defined by the time format in Windows
Control Panel.
/ Date separator. The actual character that is output is defined by the date format in Windows'
Control Panel.
- + $ ( ) Space character The specified character is output. To output any other character, it must be preceded by a
backslash \ or enclosed in quotation marks.
\ The character following the \ is output. The backslash itself is not displayed. To output a
backslash, duplicate it (\\).
Note: Quotation marks may not be used in format strings; even \" causes an error message.
"Text" The string enclosed in quotation marks is output. The quotation marks themselves are not
displayed.
* Defines the character immediately following as a fill character. Spaces will then be filled using
this character.
2 sections The format in the first section applies to positive values and zero, the one in the second section to
negative values.
3 sections The first format applies to positive values, the second one to negative values and the third one to
zero.
4 sections The first format applies to positive values, the second one to negative values, the third one to
zero and the fourth one to Null values (see the IsNull function).
If one of these sections is left empty, the format for positive numbers will be used in its place.
The individual sections must be separated by semicolons.
Examples
The following table gives some examples. The left column shows the format expression, the remaining columns
show the results for the numbers 3, -3 and 0.3.
Format 3 -3 0.3
(empty) 3 -3 0.3
"0" 3 -3 0
"#,##0" 3 -3 0
Statements and functions from A to Z 351
"$#,##0;($#,##0)" $3 ($3) $0
General Date Outputs the date and/or time without any formatting (i.e., typically in the short date format).
Medium Date Outputs the date using month names abbreviated to three characters.
c Returns the complete date in the short date format and the complete time in hh:nn:ss format.
Examples
Some examples are shown in the following table:
Statements and functions from A to Z 353
"m/d/yy" 2/26/20
"hh:nn:ss" 18:45:15
@ Outputs a character or a space character. The output is usually right-aligned (see, however, also the !
sign).
FreeFile (function)
FreeFile [()]
Returns the index of the next free file pointer. The result is an integer value between 1 and 255.
File indices are required when opening files (see the Open statement).
See also: Open
Example:
Sub Main
A = FreeFile
Open "TESTFILE" For Output As #A
Write #A, "Test"
Close #A
Kill "TESTFILE"
End Sub
Statements and functions from A to Z 354
Function (statement)
Function Name [(ArgumentList)] [As Type]
[Statements]
Name = Expression
End Function
Declaring parameters
[ByVal | ByRef] Variable [As Type]
The keywords ByVal or ByRef (default value) are used to indicate whether the parameter is passed by value or
by reference (see the section Passing parameters via ByRef or ByVal).
Type specifies the data type (String, Integer, Double, Long, Variant). Alternatively, the type can be indicated
by appending a type suffix (e.g. % for Integer) to the variable name (see the section Data types).
See also: Dim, End, Exit, Sub
Example:
Sub Main
For i% = 1 to 10
Print GetColor2(i%)
Next i
End Sub
Function GetColor2(c%) As Long
GetColor2 = c% * 25
If c% > 2 Then
GetColor2 = 255 ' 0x0000FF - Red
End If
If c% > 5 Then
GetColor2 = 65280 ' 0x00FF00 - Green
End If
If c% > 8 Then
GetColor2 = 16711680 ' 0xFF0000 - Blue
End If
End Function
Statements and functions from A to Z 355
GetObject (function)
GetObject(Name [,Class])
Gosub jumps to a place in the script that is marked with the jump target Label; Return goes back to the calling
place.
The jump target Label must reside inside the same subroutine or function from which the Gosub command is
called.
Note: Gosub ... Return is provided only for compatibility with older Basic versions. It is recommended to use
the statement Sub for subroutines instead.
See also: Goto, Sub, section Flow control
Example:
Sub Main
Print "Main program"
Gosub Detour
Exit Sub
Detour:
Print "Subroutine"
Return
End Sub
Statements and functions from A to Z 356
Goto (statement)
Goto Label
.
.
.
Label:
Statements
Hex (function)
Hex(Num)
Hour (function)
Hour(Expression)
Or:
If Condition Then Statements [Else Statements]
Executes a group of statements if Condition is true. Optionally executes a different group of statements if
Condition is false (see also the section Flow control).
Statements and functions from A to Z 358
Input (function)
Input(n, [#]FileNumber)
InputBox (function)
InputBox(Prompt$ [,[Title$] [,[Default$] [,X, Y]]])
Displays a dialog box in which the user can input something. The result is a string consisting of the user input.
Statements and functions from A to Z 359
InStr (function)
InStr(Start, String, SearchString)
Returns the position of the first occurrence of the string SearchString within the string String.
Start is the starting position of the search; use the value 1 to search within the whole string. Start must be a
positive integer number.
String is the string expression to be searched.
SearchString is the string expression to search for.
See also: Mid, StrComp
Example:
Statements and functions from A to Z 360
Sub Main
B$ = "SoftMaker Basic"
A = InStr(2, B$, "Basic")
MsgBox A
End Sub
Int (function)
Int(Num)
IsDate (function)
IsDate(Variant)
IsEmpty (function)
IsEmpty(Variant)
See also: IsDate, IsNull, IsNumeric, VarType, section Special behavior of the Variant data type
Example:
Sub Main
Dim x ' Empty because no value was assigned
MsgBox "IsEmpty(x): " & IsEmpty(x)
x = 5 ' Is not empty anymore
MsgBox "IsEmpty(x): " & IsEmpty(x)
x = Empty ' Is empty again
MsgBox "IsEmpty(x): " & IsEmpty(x)
End Sub
IsNull (function)
IsNull(Variant)
Checks whether the passed Variant variable has the value "Null".
The special value "Null" shows that the variable does not have any value. Please note that this value is different
from the numeric value 0, from empty strings and from the special value Empty which shows that a variable
has not been initialized.
See also: IsDate, IsEmpty, IsNumeric, VarType, section Special behavior of the Variant data type
IsNumeric (function)
IsNumeric(Variant)
Kill (statement)
Kill FileName
LBound (function)
LBound(Array [,Dimension])
LCase (function)
LCase(String)
Left (function)
Left(String, n)
Returns a string consisting of the first n characters of the passed string String.
See also: Len, Mid, Right
Example:
Sub Main
Dim LWord, Msg, RWord, SpcPos, UsrInp
Msg = "Enter two words "
Msg = Msg & "separated by a space character."
UsrInp = InputBox(Msg)
SpcPos = InStr(1, UsrInp, " ") ' Find space character
If SpcPos Then
LWord = Left(UsrInp, SpcPos - 1) ' Left word
RWord = Right(UsrInp, Len(UsrInp) - SpcPos) ' Right word
Msg = "The first word is " & LWord & ","
Msg = Msg & " the second word is " & RWord & "."
Else
Statements and functions from A to Z 364
Len (function)
Len(String)
Let (statement)
[Let] Variable = Expression
Reads a line from a file and stores the result in the string or Variant variable Name.
FileNumber is the number assigned to the file by the Open statement. The file must have been opened with the
command Open for reading beforehand.
The statement Line Input reads the characters from the file until a line feed (LF) or a combination of carriage
return + line feed (CR+LF) is encountered.
See also: Input, Open, Seek
Example:
Sub Main
Open "c:\autoexec.bat" For Input As #1 ' Open file
While Not EOF(1) ' Repeat until end of file
Line Input #1, TextLine ' Read line from file
Print TextLine ' Output line
Wend
Close #1 ' Close file
End Sub
Log (function)
Log(Num)
Mid (function)
Mid(String, Start [, Length])
Returns a substring of the passed string String. It starts with the position Start and is Length characters long. If
Length is omitted, the entire rest of the string is returned.
See also: Len, Left, Right
Example:
Sub Main
MidTest = Mid("Potato salad", 8, 4)
MsgBox MidTest ' Result: "sala"
End Sub
Minute (function)
Minute(Expression)
MkDir (statement)
MkDir Path
Month (function)
Month(Expression)
MsgBox (function)
MsgBox(Text [, Type] [, Title])
MB_APPLMODAL 0 The message box is application-modal. The current task does not accept
input until the user closes the message box.
Statements and functions from A to Z 369
MB_SYSTEMMODAL 4096 The message box is system-modal. The whole system does not accept any
input until the user closes the message box (use only for critical errors!).
From each of the four shown groups a value can be chosen. Combine the individual constants by adding their
values.
IDOK 1 Button OK
IDNO 7 Button No
Example:
This example uses MsgBox to display a confirmation dialog.
Sub Main
Dim DgDef, Msg, Response, Title
Title = "MsgBox Example"
Msg = "Do you want to continue?"
DgDef = MB_YESNOCANCEL + MB_ICONQUESTION + MB_DEFBUTTON3
Response = MsgBox(Msg, DgDef, Title)
If Response = IDYES Then
Msg = "You have chosen Yes."
ElseIf Response = IDCANCEL Then
Msg = "You have chosen Cancel."
Else
Msg = "You have chosen No."
End If
MsgBox Msg
End Sub
Statements and functions from A to Z 370
Name (statement)
Name OldName As NewName
Now (function)
Now[()]
Oct (function)
Oct(Num)
On Error (statement)
On Error Goto Label
Or:
On Error Resume Next
Or:
On Error Goto 0
Example:
In this example, an error is intentionally caused in order to execute the error handling routine at the label
"Error". Then the user is asked whether the script's execution should be continued or not. If the answer is "Yes",
execution will continue using the Resume Next command with the next line after the runtime error. If the
answer is "No", execution ends with the Stop command.
Sub Main
On Error Goto MyErrorHandler
Print 1/0 ' Causes a "division by zero" error
MsgBox "End"
Exit Sub
MyErrorHandler: ' Error-handling routine
Dim DgDef, Msg, Response, Title
Title = "Error"
Msg = "A runtime error has been raised. Do you want to resume execution?"
DgDef = MB_YESNO + MB_ICONEXCLAMATION
Response = MsgBox(Msg, DgDef, Title)
If Response = IDYES Then
Resume Next
Else
Stop
End If
End Sub
For testing purposes, runtime errors can be artificially raised using the Err.Raise command.
Syntax: Err.Raise Number
Number is the number of a runtime error. There are the following runtime errors:
3: "RETURN without GOSUB"
5: "Invalid procedure call"
6: "Overflow"
7: "Out of memory"
9: "Subscript out of range"
10: "Array is fixed or temporarily locked"
11: "Division by zero"
13: "Type mismatch"
14: "Out of string space"
16: "Expression too complex"
17: "Can't perform requested operation"
18: "User interrupt occurred"
20: "RESUME without error"
28: "Out of stack space"
35: "Sub, Function, or Property not defined"
47: "Too many DLL application clients"
48: "Error in loading DLL"
49: "Bad DLL calling convention"
51: "Internal error"
52: "Bad file name or number"
53: "File not found"
54: "Bad file mode"
55: "File already open"
57: "Device I/O error"
Statements and functions from A to Z 373
Open (statement)
Open FileName [For Mode] [Access AccessMode] As [#]FileNumber
Mode Description
Input Sequential input. The file must already exist. AccessMode, if given, must be set to Read.
Output Sequential output. The file is automatically created for output. If a file with the given name already
exists, the file will be overwritten. AccessMode, if given, must be set to Write.
Append Sequential output. Identical to Output, however the file pointer will be set to the end of the file, so
that all following output commands append data to the existing file.
The optional parameter AccessMode restricts the type of access to the file:
AccessMode Description
If the file does not exist, it will be automatically created, if either Append or Output mode was chosen;
otherwise the Open command fails.
If the file is already opened by another process or the desired access mode is not possible, the Open command
fails.
FileNumber is an integer value between 1 and 255 which identifies the file in the following access functions.
The index of the next free file pointer can be returned using the FreeFile function.
See also: Close, FreeFile
Example:
Sub Main
Open "TESTFILE" For Output As #1 ' Create file
userData1$ = InputBox("Enter one text line.")
userData2$ = InputBox("Enter one more text line.")
Write #1, userData1, userData2 ' Write lile
Close #1
Open "TESTFILE" for Input As #2 ' Open file
Print "File contents:"
Do While Not EOF(2)
Line Input #2, FileData ' Read line
Print FileData
Loop
Close #2 ' Close file
Kill "TESTFILE" ' Delete file
End Sub
Statements and functions from A to Z 375
Defines the default lower bound for array indices. The allowed values are 0 and 1.
If Option Base is not specified, the lower bound of all arrays that do not explicitly specify their lower bound is
0.
This statement must reside outside a procedure and before all array definitions.
See also: Dim, LBound, section Arrays
Example:
Option Base 1
Sub Main
Dim A(20)
Print "The lower bound of the array is: " & LBound(A) & "."
Print "The upper bound of the array is: " & UBound(A) & "."
End Sub
Print (statement)
Print Expression [, ...]
Print # (Statement)
Print #FileNumber, [Expression]
ReDim (statement)
ReDim [Preserve] VarName(Subscripts) [As Type] [, ...]
Use the ReDim statement to set or change the length of a dynamic array.
The array contents will be erased at this point, unless you prepend Preserve to the variable name and change
only the length of the last dimension.
VarName is the name of the array variable.
Subscripts defines the number and size of the dimensions (see the section Arrays).
Type is the data type (see the section Data types).
Dynamic arrays
To create a dynamic array, it must first be declared with the statements Global or Dim, but with empty
parentheses instead of the usual specification of the number and size of the dimensions.
Example: Dim A()
The number and size of the dimensions can be later specified in the first call of the ReDim statement.
Example: ReDim A(42)
In further invocations of the ReDim statement, the size of the dimensions can be changed at will. The number
of the dimensions and the type of the array however cannot be changed after the initial setting.
Note: When executing the ReDim statement, the existing content of the array is deleted.
If you use the keyword Preserve together with this statement, you can only change the last dimension. If an
array has, for example, two dimensions, only the second dimension can be enlarged or shrunk. But the
advantage is that: the existing content of the array is preserved.
Example:
Dim B()
ReDim B(10)
.
.
ReDim Preserve B(20)
Rem (statement)
Rem Comment
Or:
'Comment
Resume (statement)
Resume [0]
Or:
Resume Next
Or:
Resume Label
Ends an error handling routine called by the On Error statement and continues execution of the script.
See also: On Error
Example:
Sub Main
On Error Goto MyErrorHandler
Print 1/0 ' Causes a "division by zero" error
MsgBox "End"
Exit Sub
MyErrorHandler: ' Error-handling routine
Dim DgDef, Msg, Response, Title
Title = "Error"
Msg = "A runtime error has been raised. Do you want to resume execution?"
DgDef = MB_YESNO + MB_ICONEXCLAMATION
Response = MsgBox(Msg, DgDef, Title)
If Response = IDYES Then
Resume Next
Else
Stop
Statements and functions from A to Z 379
End If
End Sub
Right (function)
Right(String, n)
Returns a string consisting of the last n characters of the passed string String.
See also: Len, Left, Mid
Example:
Sub Main
Dim LWord, Msg, RWord, SpcPos, UsrInp
Msg = "Enter two words "
Msg = Msg & "separated by a space character."
UsrInp = InputBox(Msg)
SpcPos = InStr(1, UsrInp, " ") ' Find space character
If SpcPos Then
LWord = Left(UsrInp, SpcPos - 1) ' Left word
RWord = Right(UsrInp, Len(UsrInp) - SpcPos) ' Right word
Msg = "The first word is " & LWord & ","
Msg = Msg & " the second word is " & RWord & "."
Else
Msg = "You did not enter two words."
End If
MsgBox Msg
End Sub
RmDir (statement)
RmDir Path
RmDir "t1"
RmDir "t2"
End Sub
Rnd (function)
Rnd [()]
Second (function)
Second(Expression)
Seek (statement)
Seek [#]FileNumber, Position
Sets the file pointer to a new position in a file. This command works only on open files.
FileNumber is a number assigned to a file by Open statement.
Statements and functions from A to Z 381
Position is the position within the file from which the next read or write operation should start (as offset in
bytes from the beginning of the file).
See also: Open
Example:
Sub Main
Open "TESTFILE" For Input As #1 ' Open file
For i = 0 To 24 Step 3
Seek #1, i ' Set file pointer
MyChar = Input(1, #1) ' Read character
Print MyChar ' Output character
Next i
Close #1 ' Close file
End Sub
Executes one of several statement blocks, depending on the value of the given expression (see also the section
Flow control).
A Select Case structure must be closed with End Select.
See also: If Then Else, section Flow control
Example:
Sub Main
Number = InputBox("Enter an integer number between 1 and 3:")
Select Case Val(Number)
Case 1
MsgBox "You entered the number One."
Case 2
MsgBox "You entered the number Two."
Case 3
MsgBox "You entered the number Three."
Statements and functions from A to Z 382
Case Else
MsgBox "Only the integer values between 1 and 3 are allowed!"
End Select
End Sub
SendKeys (statement)
SendKeys(Keys, [Wait])
Simulates keystrokes.
Keys is a string containing the keys to be pressed.
If the optional parameter Wait is True, control returns to the script only when the receiving application has
completed processing of the keystroke.
To pass "regular" keys, just type them – for example, "Test". Special keys such as the Enter or Alt key can be
added as follows:
§ The keys + ^ ~ % ( ) [ ] { and } have a special meaning. If you want to use them verbatim, they must be
enclosed by curly braces – for example: "{%}" or {(}.
§ Special keys such as the Enter key must be also enclosed by curly braces – for example: {Enter}. You can
find a list of the special keys in the next section Special keys supported by the SendKeys command.
§ Key combinations containing the Shift, Alt and Ctrl keys can be added using one of the following prefixes
(+, ^ or %):
Shift+Enter: "+{Enter]"
Alt+F4: "%{F4}"
Strg+C: "^c" (not ^C!)
Pay attention to case: For example, "^c" represents the key combination Ctrl+C, but "^C" represents
Ctrl+Shift+C.
§ If quotation marks need to be passed, they must be doubled – for example, "Arthur ""Two Sheds"" Jackson".
§ A sequence of keys can be added by following the keystrokes with the number of repetitions, all enclosed by
curly braces: "{a 10}" repeats the key a ten times, {Enter 2} repeats the Enter key twice.
§ The Enter key can be also expressed with the code ~. The code "ab~cd", for example, is identical to
"ab{Enter}cd"
Example:
Sub Main
X = Shell("Calc.exe", 1) ' Invoke the Calculator application
For i = 1 To 5
SendKeys i & ".+}", True ' Send keystrokes
Next i
Msg = "The calculator will be closed now."
Statements and functions from A to Z 383
MsgBox Msg
AppActivate "Calculator" ' Set the focus to the calculator
SendKeys "%{F4}", True ' Send Alt+F4 to close the application
End Sub
Enter {Enter}
Shift key Prepend the sign + (for example +{F9} for Shift+F9)
Alt key Prepend the sign % (for example %{F9} for Alt+F9)
Ctrl key Prepend the sign ^ (for example ^{F9} for Ctrl+F9)
Tab {Tab}
Cursor ip {Up}
Home {Home}
End {End}
Page up {PageUp}
Insert {Insert}
Ctrl+Break {Break}
F1 {F1}
F12 {F12}
Set (statement)
Set Object = [New] ObjectExpression
Or:
Set Object = Nothing
The first notation connects an object variable to an OLE object; the second severs the link.
See also: Dim, Static, section OLE Automation
Statements and functions from A to Z 385
Sgn (function)
Sgn(Num)
Shell (function)
Shell(AppName [, Mode])
Starts a program.
The return value is a task ID which identifies the launched program. Values below 32 indicate that launching
the program failed.
AppName is the name of the executable file. The name must have one of the following file
extensions: .PIF, .COM, .BAT or .EXE.
The optional parameter Mode indicates in which window state the new program should be opened:
Value Meaning
If X < 32 Then
MsgBox "The calculator could not be started"
Stop
End If
For i = 1 To 5
SendKeys i & ".+}", True ' Send keystrokes
Next i
Msg = "The calculator will be closed now."
MsgBox Msg
AppActivate "Calculator" ' Set the focus to the calculator
SendKeys "%{F4}", True ' Send Alt+F4 to close the application
End Sub
Sin (function)
Sin(Num)
Space (function)
Space(n)
Sqr (function)
Sqr(Num)
Static (statement)
Static Variable
i = i + 5
Print i
End Sub
Stop (statement)
Stop
Str (function)
Str(Num)
StrComp (function)
StrComp(String1, String2 [, IgnoreCase])
String (function)
String(Num, Character)
Sub (statement)
Sub Name [(ArgumentList)]
[Dim Variable(s)]
[Statements]
[Exit Sub]
End Sub
Declaring parameters
[ByVal | ByRef] Variable [As Type]
The keywords ByVal or ByRef (default value) are used to indicate whether the parameter is passed by value or
by reference (see the section Passing parameters via ByRef or ByVal).
Type specifies the data type (String, Integer, Double, Long, Variant). Alternatively, the type can be indicated
by appending a type suffix (e.g. % for Integer) to the variable name (see the section Data types).
See also: Call, Dim, Function
Example:
Sub Main
Dim Var1 as String
Var1 = "Hello"
MsgBox "Test"
Test Var1
MsgBox Var1
End Sub
Sub Test(wvar1 as String)
wvar1 = "Bye!"
End Sub
Tan (function)
Tan(Num)
Time (function)
Time [()]
TimeSerial (function)
TimeSerial(Hour, Minute, Second)
Returns the time serial corresponding to the parameters Hour, Minute and Second.
See also: DateSerial, DateValue, Hour, Minute, Now, Second, Time, TimeValue
Example:
Sub Main
Print TimeSerial(09, 30, 59)
End Sub
TimeValue (function)
TimeValue(TimeString)
Returns a double precision serial number corresponding to the parameter TimeString. This parameter can be any
string that represents a time.
See also: DateSerial, DateValue, Hour, Minute, Now, Second, Time, TimeSerial
Statements and functions from A to Z 392
Example:
Sub Main
Print TimeValue("09:30:59")
End Sub
Type (statement)
Type TypeName
Element As Type
Element As Type
Element As Type
.
.
.
End Type
UBound (function)
UBound(ArrayName[, Dimension])
UCase (function)
UCase(String)
Val (function)
Val(String)
VarType (function)
VarType(VarName)
Empty 0
Null 1
Integer 2
Long 3
Single 4
Double 5
Date 7
String 8
Object 9
Boolean 11
See also: IsDate, IsEmpty, IsNull, IsNumeric, section Special behavior of the Variant data type
Statements and functions from A to Z 396
Example:
If VarType(x) = 5 Then Print "Variable is of type Double"
Weekday (function)
Weekday(Expression)
Executes a group of statements repeatedly as long as the given condition is true (see also the section Flow
control).
See also: Do Loop, section Flow control
With (statement)
With Object
[Statements]
End With
Write # (statement)
Write #FileNumber, [Expression]
Year (function)
Year(Expression)
Appendix
The appendix contains the following information:
§ Ribbon commands and corresponding menu commands
In this section you will find a table of all commands in the ribbon and the corresponding classic menu
command.
§ Color constants
This section contains a list of all pre-defined color constants.
§ Command-line parameters
Here, you will find an overview of parameters that can be used to directly trigger a specified program option
when you start BasicMaker.
Tip 1: You can switch the user interface between ribbon and classic menus at any time. To do so, choose the
command File | Options in the ribbon (or choose Tools > Options in the classic menu interface). In the
dialog box, switch to the Appearance tab and click on the User interface button. The program will display a
dialog box in which you can choose the desired user interface.
Tip 2: Use the "hamburger menu" (the icon on the left in the Quick access toolbar) if you still want to
access the classic menu commands from the ribbon interface.
Example: The ribbon command File | Document | Save can be found under File > Save in the classic menu
interface.
Another entry >> is also added for some commands if the command can only be found in the submenu of an
icon or in a dialog box.
Appendix 400
Ribbon Menu
Ribbon Menu
Home | Program | Delete all breakpoints Program > Delete all breakpoints
View | Window | Windows >> Close all Window > Close all
Appendix 403
Color constants
There are several properties in TextMaker and PlanMaker that let you retrieve or set colors. These are available
in two variations: once for working with BGR colors ("blue-green-red") and once with index colors – with the
latter, TextMaker's default colors are simply enumerated with consecutive numbers.
For example, Selection.Font.Color sets the color of the currently selected text in TextMaker to the BGR color
value that you pass as an argument. The method Selection.Font.ColorIndex, in contrast, expects an index
color.
On the next pages you fill find a list of all pre-defined color constants that can be used in such statements. It is
split into the following sections:
§ Color constants for BGR colors
§ Color constants for index colors
smoColorPink = &hFF00FF&
smoColorLightBlue = &hFF6633&
smoColorLightOrange = &h0099FF&
smoColorLightYellow = &h99FFFF&
smoColorLightGreen = &hCCFFCC&
smoColorLightTurquoise = &hFFFFCC&
smoColorDarkBlue = &h800000&
smoColorDarkGreen = &h003300&
smoColorDarkRed = &h000080&
smoColorDarkTeal = &h663300&
smoColorDarkYellow = &h008080&
smoColorGray05 = &hF3F3F3&
smoColorGray10 = &hE6E6E6&
smoColorGray125 = &hE0E0E0&
smoColorGray15 = &hD9D9D9&
smoColorGray20 = &hCCCCCC&
smoColorGray25 = &hC0C0C0&
smoColorGray30 = &hB3B3B3&
smoColorGray35 = &hA6A6A6&
smoColorGray375 = &hA0A0A0&
smoColorGray40 = &h999999&
smoColorGray45 = &h8C8C8C&
smoColorGray50 = &h808080&
smoColorGray55 = &h737373&
smoColorGray60 = &h666666&
smoColorGray625 = &h606060&
smoColorGray65 = &h595959&
smoColorGray75 = &h404040&
smoColorGray85 = &h262626&
smoColorGray90 = &h191919&
smoColorGray70 = &h4C4C4C&
smoColorGray80 = &h333333&
smoColorGray875 = &h202020&
smoColorGray95 = &hC0C0C0&
The colors smoColorAutomatic and smoColorTransparent serve specific purposes and cannot be used at
will:
§ smoColorAutomatic lets you set the color of the sheet grid in PlanMaker to "Automatic".
§ smoColorTransparent lets you set the background color of text to "Transparent" in TextMaker and
PlanMaker.
Tip: Those properties that use BGR colors are more flexible and should be used preferably.
The colors smoColorIndexAutomatic and smoColorIndexTransparent serve specific purposes, as follows:
§ smoColorIndexAutomatic sets the text color in TextMaker or the color of the sheet grid in PlanMaker to
"Automatic".
§ smoColorIndexTransparent sets the background color of text to "Transparent" in TextMaker or
PlanMaker.
Appendix 406
Command-line parameters
Note: The command-line parameters described here only work on Windows.
Command-line parameters allow you to specify that BasicMaker is started immediately with a specific program
option rather than with the usual default behavior. You would like BasicMaker to jump to line 20 of the
specified script directly upon startup.
To insert a command-line parameter, proceed as follows:
1. Create a new shortcut to BasicMaker on the desktop. Ideally, give the link a distinctive name in order to
distinguish it more clearly.
2. Choose the properties of the shortcut: Right-click on the link for the context menu and select the entry
Properties.
3. The following dialog box with the Shortcut tab will then appear:
Appendix 407
4. In the input field Target after the file path "...\BasicMaker.exe", enter the desired parameter from the
table below. In the figure above, for example, this is the parameter -Line.
Important: There must be a space in front of the parameter and the parameter starts with a hyphen.
Command-line parameters
Parameter Description
-FO BasicMaker starts with an open dialog box for selecting a file.
-P"Path\FileName" BasicMaker starts and prints the specified script directly on the default
printer.
-Q"PrinterName","Path\FileName" BasicMaker starts and prints the specified script directly on the specified
Note: No space is inserted printer.
within the parameter.
-Line=xxx "Path\FileName" BasicMaker starts and jumps directly to the specified line of the specified
Note: A space is required here before script (e.g. Line=20 jumps to line 20).
"Path\FileName".
-S "Path\FileName" BasicMaker starts the specified script in silent mode (BasicMaker remains
Note: A space is required here before hidden in the background).
"Path\FileName".
Index 408
- =
- (operator) 41 = (operator) 41
! >
! (suffix) 38 > (operator) 41
>= (operator) 41
#
# (suffix) 38 A
#include (statement) 325 Abs (function) 325
Absolute value 325
Accounting (property) 279
$ Activate (method) 68, 94, 172, 198, 228, 245, 310
$ (suffix) 38
ActiveCell (pointer to object) 198, 310
ActiveDocument (pointer to object) 68
% ActiveSheet (pointer to object) 198, 228, 310
% (suffix) 38 ActiveWindow (pointer to object) 68, 94, 198, 228
ActiveWorkbook (pointer to object) 198
Add (method) 56, 87, 91, 135, 166, 182, 220, 224,
& 243, 297, 316
& (operator) 41 Addition 41
& (suffix) 38 AlertStyle (property) 297
&H (prefix for hexadecimal numbers) 36 Alignment (property) 125
&O (prefix for octal numbers) 36 AllCaps (property) 118, 284
AllowBreakInRow (property) 141
And 41
* And (operator) 41
* (operator) 41 AppActivate (statement) 326
Application
/ activate 326
start 385
/ (operator) 41 Application (object) 68, 198
Application (pointer to object) 68, 75, 79, 81, 82, 84,
^ 85, 87, 89, 91, 94, 103, 105, 108, 111, 118, 124, 125,
131, 133, 135, 137, 139, 141, 143, 145, 148, 151, 154,
^ (operator) 41 157, 158, 162, 163, 165, 166, 169, 170, 172, 176, 181,
182, 184, 186, 188, 198, 210, 213, 214, 216, 218, 219,
220, 222, 224, 228, 238, 240, 243, 245, 252, 258, 275,
+ 277, 279, 284, 290, 292, 294, 297, 304, 305, 307, 309,
+ (operator) 41 310, 316, 319, 321, 322
ApplyFormatting (method) 258
AppPlanMaker (function) 326
< AppSoftMakerPresentations (function) 327
< (operator) 41 AppTextMaker (function) 327
<= (operator) 41 Arctangent 328
<> (operator) 41 Arithmetic functions 324
Arrays 40, 362, 394
Index 409
Collections, use 62, 193 CreateObject (function) 56, 59, 190, 335
Color (property) 118, 151, 284, 292 Criteria1 (property) 307
Color constants 403 CSng (function) 335
Color constants for BGR colors 403 CStr (function) 336
Color constants for index colors 404 CurDir (function) 336
ColorIndex (property) 118, 151, 284, 292 Currency (property) 279
ColumnBreakBefore (property) 125 CustomFormat (property) 279
Columns (collection) 277 Cut (method) 111, 258
Columns (pointer to collection) 198 Cut text 15
Columns (pointer to object) 245
ColumnWidth (property) 258
Combo box 33, 50
D
Data types 38
ComboBox 50
Date 324
Command button 49
check for 360
CommandBar (object) 84, 218 determine current date 336, 370
CommandBars (collection) 82, 216 determine day 337
CommandBars (pointer to object) 68, 198 determine month 367
Command-line parameters 406 determine weekday 396
Commands in the Edit menu of the dialog editor 32 determine year 398
Commands in the File menu of the dialog editor 31 Date (function) 336
Commands in the Insert menu of the dialog editor 33 Date/time formats of the Format function 351
Commands of the script editor DateFormat (property) 279
File ribbon tab 12 DateSerial (function) 337
Home ribbon tab 15 DateValue (function) 337
Quick access toolbar 21 Day (function) 337
View ribbon tab 20 Debug a script 28
Comment (property) 258 Debugger 28
Comments 378 Decimal numbers 36
CommentsPaneAutoShow (property) 176 Declare (statement) 45, 46, 338
Concatenation 41 DefaultFileFormat (property) 75
Connect to PlanMaker 191 DefaultFilePath (property) 75, 210
Connect to TextMaker 60 DefaultTemplatePath (property) 75, 210
Const (statement) 334 Delete
Constants 334 bookmarks 18
Controls of a dialog box 48 text 15
Conversion 324 Delete (method) 89, 111, 169, 222, 245, 258, 297
ConvertToTable (method) 111 Delete all breakpoints (script) 29
ConvertToText (method) 137 Dialog (function) 47, 339
Copy (method) 111, 258 Dialog boxes 30, 47
Copy text 15 Dialog definition 30, 47
CorrectInitialCaps (property) 85 Dialog editor 30
CorrectSentenceCaps (property) 85 Dialog editor, open/close 30
Cos (function) 334 Dialog editor, use 30
Cosine 334 Dialog function 54
Count (property) 56, 79, 82, 87, 91, 103, 124, 135, Dialog language 22
139, 143, 148, 157, 166, 170, 182, 186, 213, 216, 220, Digits (property) 279
224, 238, 243, 275, 277, 290, 305, 309, 316, 321 Dim (statement) 40, 340
CreateBackup (property) 75, 210
DisplayColumnHeadings (property) 245
Index 411
N P
Name (property) 68, 84, 89, 94, 105, 118, 158, 169, Page setup (File) 12
172, 184, 188, 198, 218, 222, 228, 240, 245, 258, 284, PageBreakBefore (property) 125
310, 319, 322 PageBreakCol (property) 258
Name (statement) 370
PageBreakRow (property) 258
Negation 41
PageBreaks (property) 245
NegativeRed (property) 279
PageCount (property) 94
New (File) 12
PageHeight (property) 108, 252
Nonprintable (property) 258
PageSetup (object) 108, 252
Not (operator) 41
PageSetup (pointer to object) 94, 245
Not equal (operator) 41
PageWidth (property) 108, 252
Now (function) 370
PaperSize (property) 108, 252
Null 38, 361
Paragraph (object) 125
NumberFormatting (object) 279
Paragraphs (collection) 124
NumberFormatting (pointer to object) 258
Paragraphs (pointer to collection) 94
Numeric formats of the Format function 348
Parent (pointer to object) 75, 79, 81, 82, 84, 85, 87, 89,
91, 94, 103, 105, 108, 111, 118, 124, 125, 131, 133,
135, 137, 139, 141, 143, 145, 148, 151, 154, 157, 158,
O 162, 163, 165, 166, 169, 170, 172, 176, 181, 182, 184,
Object (data type) 38, 56 186, 188, 210, 213, 214, 216, 218, 219, 220, 222, 224,
Object model of PlanMaker 196 228, 238, 240, 243, 245, 252, 258, 275, 277, 279, 284,
Object model of TextMaker 66 290, 292, 294, 297, 304, 305, 307, 309, 310, 316, 319,
321, 322
Oct (function) 371
Passing parameters via ByRef or ByVal 46
Octal 371
Paste
Octal numbers 36 dialog 15
OK button 33, 49 document 15
OKButton 49 SmartText 15
OLE Automation 56, 59, 190, 335, 355 special characters 15
On Error (statement) 371 Paste (method) 111, 258
Open (method) 184, 224, 319 PasteAdjustWordSpacing (property) 75
Open (statement) 373 Path (property) 68, 94, 172, 184, 198, 228, 310, 319
Open a file 373 Percentage (property) 181
Open a script 12 PicasToPoints (method) 68, 198
Operator (property) 297, 307 Pitch (property) 118, 284
Operators 41 PlanMaker
Option Base (statement) 40, 375 object model 196
Index 415
W
WarningOnError (property) 198
Watch variables 29
Weekday (function) 396
What is BasicMaker? 10
While ... Wend (statement) 43, 396
WidowControl (property) 125
Width (property) 68, 145, 172, 198, 310
Window (object) 172, 310
Windows
close all 20
Windows (collection) 170, 309
Windows (pointer to collection) 68, 198
WindowState (property) 68, 172, 198, 310
With (statement) 39, 64, 195, 396
Workbook (object) 228
Workbook (pointer to object) 258, 310