|
To get started in scripting OAK:
| 1 | Get into the VBA development environment. Alt+F11 will do this. |
| 2 | Use the Tools | References command to find the list of software libaries available for VBA to access. |
| 3 | Find the entry for the Operis Analysis Kit VBA Type Library in the library and enable it. |

| 4 | Press OK to dismiss the Tools | References dialog. |
| 5 | Now press F2. That will bring up the Class Browser. If you filter for Operis_OAK, you will find the various methods and properties listed in this help. |

| 6 | Write the following code in a VBA module |
Option Explicit
Sub Main()
Dim o As Operis_OAK.IOAKAddIn
Set o = CreateObject("Operis.OAK.Connect")
Set o.ExcelApplication = Application
o.BuildNameDatabase
End Sub
| 7 | Run this and the dialog of OAK's Build name database command will appear. |

Click OK, and OAK will generate a report of the names that are defined in the currently active workbook. (If, as is likely, that's a new, unused workbook, the report will say that there are no names defined in that workbook.)
| 8 | Change the code a little (changes in bold) |
Option Explicit
Sub Main()
Dim o As Operis_OAK.IOAKAPI
Set o = CreateObject("Operis.OAK.Connect")
Set o.ExcelApplication = Application
o.BuildNameDatabase ActiveWorkbook, True, Nothing, False, True, True
End Sub
This time, when the code is run, the same report is generated, but without the dialog appearing. The characteristics of the required report are specified in the program as arguments to the BuildNameDatabase command, rather than manually by the user through the dialog.
See also
Making scripting faster
|