How i can connect to microsoft excel with zemax?
Solved
How i can connect to microsoft excel with zemax?
Best answer by Csilla Timar-Fulep
Hello Sheng-BO,
Thanks for your question here!
You can connect to Excel throught ZOS-API. The communication between Excel and ZOS-API is easy once you have the references enabled in Visual Basic for Applications environment. To do so, open VBA (Alt+F11 from any Excel sheet), then click on Tools > References and finally scroll down to the bottom of the list and select ZOSAPI and ZOSAPI_Interfaces:
From here, you can create a new Module and create your subroutines.
There are a few things to note, please see them below:
- You need to explicitly declare your variable types with the Dim keyword (at the beginning of your Sub)
- For any method which is not assigned to a variable, you will need to treat it like a ZPL keyword where you don’t use the parenthesis to pass in the arguments
- There is INTELLISENSE
- Inheritance: When a child class inherits from a parent class, you will need to have 2 variables defined to use the API tools, one for the child tool to set the specific properties and one for the parent tool to run & close the tool.
If you have further questions, please let us know and we will be happy to help!
Best,
Csilla
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.