Wait for Function Call to Finish before processing next line

Wait for Function Call to Finish before processing next line

Hi,
I'm programming at the moment some vba scripts and I have the following problem:
When I run my script on my laptop, (network inactive), everything works fine.
When I test the same script online (two scada servers and two terminal servers), it doesn't work.
What I have is:
- I open a form.
- When pressing a button in the form, the following is done:
- Inputbox is shown. Waiting for operator to enter a SetPoint.
- Function call to a function located under ThisProject. This function processes the Set Point and makes some calculations. The results are written in doubles located under ThisProject.
- The script started when pressing the button continues and uses the results of the called function.
When I test with the network active, the script behind the button works with old data, as the function call takes too much time.
What is the best way to wait in my script for a function call to finish?
I thought of programming a timer, but maybe there are better solutions.
I use Sicam 230 V7.11.
Best regards,
Philippe

This is a migrated post! Originally posted on 21.01.2016 by user philippevdt. Please be aware that information can be outdated.