Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Synchronizing VBA Script

How can I force the VBA script in Excel to wait till an Excel add-in function
completes retrieving data asynchronously from an external data source. I
tried Msgbox statement; but the OK button becomes active before the data
retrieval is completed.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Synchronizing VBA Script

Do you have a way of knowing when the data retrieval has been completed?
If so, something like

'Retrieve data

Do
DoEvents
Loop Until AllDataReceivedTest

Venu wrote:
How can I force the VBA script in Excel to wait till an Excel add-in function
completes retrieving data asynchronously from an external data source. I
tried Msgbox statement; but the OK button becomes active before the data
retrieval is completed.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Synchronizing VBA Script

It is not possible to know whether data retrieval has been completed; data
just gets populated in various cells. Excel status bar shows the progress
such as "Calculating Cells : 75%".

"Gareth" wrote:

Do you have a way of knowing when the data retrieval has been completed?
If so, something like

'Retrieve data

Do
DoEvents
Loop Until AllDataReceivedTest

Venu wrote:
How can I force the VBA script in Excel to wait till an Excel add-in function
completes retrieving data asynchronously from an external data source. I
tried Msgbox statement; but the OK button becomes active before the data
retrieval is completed.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Synchronizing VBA Script

Providing Excel doesn't finish calculating until the data transfer has
finished... you could do something like:

'Wait until sheet finishes calculating
do
Doevents
loop until Application.CalculationState < xlDone

That should wait until it's finished calulating. Of course, you need to
ensure it starts calculating in the first place. Although it seems to be
working now you might like to throw in an

Application.calculation = xlCalculationAutomatic

or at least check it is in your code before launching the import

or maybe check the current settting, set it to automatic and then change
back if necessary.

I haven't tried all this but I hope it works.

Gareth

Venu wrote:
It is not possible to know whether data retrieval has been completed; data
just gets populated in various cells. Excel status bar shows the progress
such as "Calculating Cells : 75%".

"Gareth" wrote:


Do you have a way of knowing when the data retrieval has been completed?
If so, something like

'Retrieve data

Do
DoEvents
Loop Until AllDataReceivedTest

Venu wrote:

How can I force the VBA script in Excel to wait till an Excel add-in function
completes retrieving data asynchronously from an external data source. I
tried Msgbox statement; but the OK button becomes active before the data
retrieval is completed.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Synchronizing VBA Script

I tried the logic you had suggested; but the control comes out of the do
loop before the data retrieval is completed; Excel calculation may be
completing before the data transfer is over. Could you please provide any
other option ?

Venu

"Gareth" wrote:

Providing Excel doesn't finish calculating until the data transfer has
finished... you could do something like:

'Wait until sheet finishes calculating
do
Doevents
loop until Application.CalculationState < xlDone

That should wait until it's finished calulating. Of course, you need to
ensure it starts calculating in the first place. Although it seems to be
working now you might like to throw in an

Application.calculation = xlCalculationAutomatic

or at least check it is in your code before launching the import

or maybe check the current settting, set it to automatic and then change
back if necessary.

I haven't tried all this but I hope it works.

Gareth

Venu wrote:
It is not possible to know whether data retrieval has been completed; data
just gets populated in various cells. Excel status bar shows the progress
such as "Calculating Cells : 75%".

"Gareth" wrote:


Do you have a way of knowing when the data retrieval has been completed?
If so, something like

'Retrieve data

Do
DoEvents
Loop Until AllDataReceivedTest

Venu wrote:

How can I force the VBA script in Excel to wait till an Excel add-in function
completes retrieving data asynchronously from an external data source. I
tried Msgbox statement; but the OK button becomes active before the data
retrieval is completed.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default Synchronizing VBA Script

Umm.... without knowing more about the retrieval process it's difficult
to say.

- Is this an AddIn you wrote (and therefore have access to the code)?

- Where is data being retrieved from and how?

- What code is running that need to wait? Is it some code that calls
the retrieval process? An event that runs?

G

Venu wrote:
I tried the logic you had suggested; but the control comes out of the do
loop before the data retrieval is completed; Excel calculation may be
completing before the data transfer is over. Could you please provide any
other option ?

Venu

"Gareth" wrote:


Providing Excel doesn't finish calculating until the data transfer has
finished... you could do something like:

'Wait until sheet finishes calculating
do
Doevents
loop until Application.CalculationState < xlDone

That should wait until it's finished calulating. Of course, you need to
ensure it starts calculating in the first place. Although it seems to be
working now you might like to throw in an

Application.calculation = xlCalculationAutomatic

or at least check it is in your code before launching the import

or maybe check the current settting, set it to automatic and then change
back if necessary.

I haven't tried all this but I hope it works.

Gareth

Venu wrote:

It is not possible to know whether data retrieval has been completed; data
just gets populated in various cells. Excel status bar shows the progress
such as "Calculating Cells : 75%".

"Gareth" wrote:



Do you have a way of knowing when the data retrieval has been completed?
If so, something like

'Retrieve data

Do
DoEvents
Loop Until AllDataReceivedTest

Venu wrote:


How can I force the VBA script in Excel to wait till an Excel add-in function
completes retrieving data asynchronously from an external data source. I
tried Msgbox statement; but the OK button becomes active before the data
retrieval is completed.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
synchronizing two woorkbooks George B Excel Worksheet Functions 2 December 22nd 07 03:12 PM
synchronizing excel application adeola Excel Discussion (Misc queries) 0 December 30th 05 07:05 PM
synchronizing (?) two worksheets Lewis Shanks Excel Worksheet Functions 0 December 19th 05 04:59 PM
Synchronizing excel spreadsheets [email protected] Excel Discussion (Misc queries) 4 May 2nd 05 03:27 AM
Excel 2000/XP script to Excel97 script hat Excel Programming 3 March 2nd 04 03:56 PM


All times are GMT +1. The time now is 04:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"