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

Solving MathCad Sheet from VBA api

BoyHowdy
4-Participant

Solving MathCad Sheet from VBA api

Would anyone have any recommendations on how to improve the code below? I use this function to solve Mathcad sheets from an Excel worksheet (using VBA code). The main hurdle here is to have the script wait until the Mathcad sheet is done calculating before moving on to other tasks. So far, this script seems to work fairly reliably, but it wouldn't surprise me if there's something better out there. 

 

Using Mathcad Prime 9.0

 

 

 

Sub SolveMathCadSheet(mathCadSheet As Ptc_MathcadPrime_Automation.Worksheet)

Dim n As Integer
mathCadSheet.ResumeCalculation
mathCadSheet.Modified = False
mathCadSheet.Synchronize
n = 0
Do While mathCadSheet.Modified = False
    Application.Wait (Now + TimeValue("0:00:01"))
    n = n + 1
    If n > 20 Then Exit Sub 
Loop


End Sub

 

 

 

1 REPLY 1

Hello @BoyHowdy,

Thank you for your question. 
I’d like to recommend to bring more details and context to your initial inquiry

It also helps to have screenshot(s) to better understand what you are trying to do in your process. 

This will increase your chances to receive meaningful help from other Community members. 

Regards,

Community Moderation Team.

Top Tags