Skip to main content

The problem with microsoft excel Connect to ZEMAX


Hi,

The Attach Files is my problem.

Why i can't Connect to ZEMAX with microsoft excel .

Can you teach me how to Connect to ZEMAX.

Thank you!

problem.png
Did this topic help you find an answer to your question?

4 replies

Forum|alt.badge.img+2

Hi Shen-Bo,

I don't t think you can connect to OpticStudio with Excel. You will need to create a standalone mode instead.

I have attached an example that you can try. Let me know if it works.

Sandrine


HI Sandrine,

This example is create a new one zemax file.

I want to get data from zemax with excel to analysis.

Is have the method to connect to my old  zemax file ?

Thank you


Allie
Zemax Staff
Forum|alt.badge.img+2
  • Zemax Staff
  • 338 replies
  • August 31, 2020

Hi Sheng-BO,

When you're using the ZOS-API with Excel, all of the API-specific commands will be open to you! This includes the commands LoadFile and LoadNewSystem. Each of these commands will allow you to load an already-generated lens file into Excel. I am attaching a quick example of how we can open a file and extract some data. 

In this example, you will see that the sample file Cooke 40 degree field.zmx is opened. This sample file is available in your {Zemax}\Samples directory. From there, the example will extract the Radius of surface 3 and print it to the first cell in the Excel workbook:

 

 

For printing to Excel, those commands are specific to that program. In my case, I hard-coded the output to a specific cell, but there are certainly other methods to write data to Excel as discussed here: https://analysistabs.com/excel-vba/write-data-to-worksheet-cell/.

For API-specific commands - these are almost always the same across programming languages. Take a look at the Knowledgebase article 'Sample code for ZOS-API users' for some examples, and the article 'Navigating the ZOS-API Syntax Help Document' for a guide on how to find the commands you need!

Let us know if you have any other questions about this. And have a great week!

Best,

Allie


Thank you


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings