Our blogs Blogs home
Software

Software

Plant

Maros and Taro API – Automating work-processes

Automation provides a standard method for one application to access the objects and properties of other applications. Maros and Taro support Automation processes so both tools can be controlled from any program that is written with Microsoft Visual Basic for Applications (VBA).

The Maros and Taro object model provides all of the functionality necessary to manipulate data that is stored in models, and it provides the ability to control many aspects of the user interface (UI).

Traditionally, users have implemented automation processes via Microsoft Excel VBA Macros. For instance, when trying to populate (or re-populate) a model with new reliability data, a Macro VBA programming via a can be used to run through a spreadsheet, identify the elements in Maros and Taro and replace the reliability data.

Using Macros in Microsoft Excel

VBA Macros in Microsoft office can be accessed via the Developer tab. To access the Developer tab on the ribbon of an Office application, you must configure it to show that tab because it doesn’t appear by default. In order to show the Developer tab in Microsoft Excel:

  • Start Excel
  • On the File tab, choose the Options button.
  • In the Excel Options dialog box, choose the Customize Ribbon button.
  • Check the box for Developer
Adding Developer tab

Adding Developer tab

When accessing the Developer tab, a range of new buttons will be shown. In order to access Microsoft Visual Basic for Applications Editor click on “Visual Basic”, as shown below:

Visual Basic

Visual Basic

This will prompt another window:

Microsoft Visual Basic for Applications Editor

Microsoft Visual Basic for Applications Editor

In Microsoft Word Visual Basic Editor, you can create references to object libraries or code in an external document or template. This allows you to call external procedures as if they were written in your own project.

Before you can use the Maros and Taro VBA functions in the Visual Basic Editor, you must establish a reference to Maros and Taro object. In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Maros 9 or Taro 5, as shown below.

References for Maros and Taro

References for Maros and Taro

To make it easier to move/share automation code between Maros and Taro we have defined the object model as DNVRAM. Each object could have a number of functions that correspond to an action that you can perform interactively.

Example showing the object referencing for Import Macro

Example showing the object referencing for Import Macro

Examples of VBA

A few examples of macros demonstrating automation code are available in the following links:

These are just a quick examples of what can be done. Knowledge around programming on VBA is essential to understand and execute the tasks. However a number of macros have been produced throughout the years and we can assist you should need any help on putting together a macro for a specific task.

For additional information about Visual Basic for Applications from Microsoft, click the following article numbers to view the articles in the Microsoft Knowledge Base:

  • 163435: Programming resources for Visual Basic for Applications
  • 141762: How to use Looping Structures in Visual Basic for Applications
  • 149689: Visual Basic Macro examples for working with arrays
  • 212536: How to run sample code from Knowledge Base articles
  • 146864: Error Trapping with Visual Basic for Applications
  • 118468: Definition of DoEvents in Visual Basic for Applications
  • 226118: Programming resources for Visual Basic for Applications
  • 184256: How to display “Now Processing” while a macro runs
  • 165517: Overview of Visual Basic Editor debugging tools
  • 164058: Passing procedure arguments in Visual Basic for Applications

SMALL LETTERS! It is important to remember that examples of Excel Macro provided by DNV GL have no warranty or liability associated with its use. Investigating problems related to Macros is not part of the Service Level agreement but we tend to help customers depending on the complexity of the work. Should you need assistance and we agree on helping, have the policy not to investigate any macro problems unless they have Option Explicit defined and they have selected Compile to check fro errors.

0 Comments Add your comment

Reply with your comment

Your email address will not be published. Required fields are marked *