This manual features many example scripts to demonstrate how the objects, properties and methods of the Maxsurf Automation interface are used. These scripts are all written in VBA and were developed using Microsoft Excel, Microsoft Word or AutoCAD. Most of the scripts in the manual can be executed by inserting the code between the dashed lines in the following macro.
Sub Test()
'definition of app and Design objects
Dim msApp As New Maxsurf.Application
Dim msDesign As Maxsurf.Design
Set msDesign = msApp.Design
'Insert sample code here!!!
'----------------------------
'----------------------------
End Sub
Note:
Many of the scripts will require a suitable
design to be open within the Maxsurf application as they refer directly to
particular control points, markers or grid lines.
Errors generated by code procedures may be related to having no design or an
inappropriate design loaded into Maxsurf.
All the example code presented in this manual was written using the VBA editor provided within Microsoft Office 2000 or AutoCAD 2004. This code uses some features not available in the version of VBA provided with versions of Microsoft Office prior to Office 2000. One significant difference is that the older version of VBA does not support the use of enumerated data types, which have been used throughout the Maxsurf Object model. For this reason we recommend the use of Microsoft Office 2000 or later products when writing VBA scripts. However, scripts can still be written using Office 97 in which case enumerated values must be replaced by their integer value. All the enumerated types, and their values, used by the Maxsurf Automation Model are listed in Appendix A of this document.