Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
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,
Solved! Go to Solution.
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
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