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

