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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Know the state of mathcad calculation through API Excel

DM_10127316
7-Bedrock

Know the state of mathcad calculation through API Excel

Hi,

 

I had conflicts between Excel VBA and Mathcad. Basically, VBA seems to not wait for Mathcad to finish its calculation, leading to errors (e.g. not retrieving outputs). I solved most of these issues by adding the command

Application.Wait (Now + TimeValue("xxx"))

which forces VBA to wait xxx seconds before resuming the code.

 

Still, I was wondering if there is a way to know from VBA the state of Mathcad (is it calculating or is it ready to start calculations?). That way, I can tell VBA to wait as a function of Mathcad state.

 

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

This is from the help files for the API and may be what you are after.

 

Object: Worksheet

Methods

DefaultCalculationTimeout(arg as integer)—Gets/Sets the DefaultCalculationTimeOut value of the worksheet. It defines the default time that the application waits for the engine to recalculate the whole document, and affects different types of Get/SetValue APIs except APIs whose time out is passed as a parameter.
arg is defined in seconds
0 means do not wait
–1 means wait no matter how long
The default time-out is 60 seconds

 

Cheers

 

View solution in original post

2 REPLIES 2

 Hi,

 

Please specify which version of Mathcad are you using?

Hi,

This is from the help files for the API and may be what you are after.

 

Object: Worksheet

Methods

DefaultCalculationTimeout(arg as integer)—Gets/Sets the DefaultCalculationTimeOut value of the worksheet. It defines the default time that the application waits for the engine to recalculate the whole document, and affects different types of Get/SetValue APIs except APIs whose time out is passed as a parameter.
arg is defined in seconds
0 means do not wait
–1 means wait no matter how long
The default time-out is 60 seconds

 

Cheers

 

Top Tags