cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Prime 8: Cant use API with Excel

DM_10127316
7-Bedrock

Prime 8: Cant use API with Excel

Hi,

 

I was doing some calculations using Prime 7 and Excel through macros. Basically, the program passes some values from Excel to Mathcad to calculate and the results are printed back to Excel. It worked fine.

 

I recently formatted my laptop and installed Prime 8. I am waiting for the license so, in the meantime, I am using the 30-days trial with full functionality.

 

I tried to use the same Prime-Excel program but it shows the following error when I run the macro: "User-defined type not defined". I have the Ptc.MathcadPrime.Automation.tlb file to VBA, as shown in the attached image.

 

Is there something I am missing? Maybe this functionality is restricted to users with license?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi everyone,

 

The problem has been solved. The code I had used the previous Mathcad 15 API commands. It worked fine before because I had Mathcad 15 and Prime 7 installed. So, after I formatted my laptop and installed Prime 8, I got the error.

 

I deleted:

Dim MC As Mathcad.Application
Dim WK As Mathcad.Worksheets
Dim WS As Mathcad.Worksheet

 

and left:

Dim MC As Ptc_MathcadPrime_Automation.Application
Dim WS As Ptc_MathcadPrime_Automation.Worksheet
Dim WStest As Ptc_MathcadPrime_Automation.Worksheet

 

and my script works fine now.

 

Thanks!

 

View solution in original post

6 REPLIES 6

Thanks! Unfortunately, that solution doesnt seem to help with my problem.

 

My issue is that VBA doesnt recognise the user-defined "Mathcad.application" type, which is part of Mathcad API.

 

 


@DM_10127316 wrote:

Hi,

 

I was doing some calculations using Prime 7 and Excel through macros. Basically, the program passes some values from Excel to Mathcad to calculate and the results are printed back to Excel. It worked fine.

 

I recently formatted my laptop and installed Prime 8. I am waiting for the license so, in the meantime, I am using the 30-days trial with full functionality.

 

I tried to use the same Prime-Excel program but it shows the following error when I run the macro: "User-defined type not defined". I have the Ptc.MathcadPrime.Automation.tlb file to VBA, as shown in the attached image.

 

Is there something I am missing? Maybe this functionality is restricted to users with license?

 

Thanks!


Hi,

I think the best way how to get the  answer is send your question to PTC Support. Please open Case on PTC Support web page.


Martin Hanák

Thanks! I will wait for the license, see if the problem persist, and then submit my issue. 

 

But, if anyone had the same issue, please let me know!

Hi everyone,

 

The problem has been solved. The code I had used the previous Mathcad 15 API commands. It worked fine before because I had Mathcad 15 and Prime 7 installed. So, after I formatted my laptop and installed Prime 8, I got the error.

 

I deleted:

Dim MC As Mathcad.Application
Dim WK As Mathcad.Worksheets
Dim WS As Mathcad.Worksheet

 

and left:

Dim MC As Ptc_MathcadPrime_Automation.Application
Dim WS As Ptc_MathcadPrime_Automation.Worksheet
Dim WStest As Ptc_MathcadPrime_Automation.Worksheet

 

and my script works fine now.

 

Thanks!

 

Top Tags