View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Javier Ortega Javier Ortega is offline
external usenet poster
 
Posts: 1
Default Need HELP with QueryTable, ADO, EXCEL and EXCEL'S Formulas

Hi,

I have made an Add-in for Excel that creates a QueryTable in a range. It is
a function that returns true o false if the query has been made ok or not.

To make this addin works it is necessary that you write a formula in an
excel cell, this formula call another function that creates a Query table in
a range expecified.

The code works ok but there is a problem.

Firstly I create a connection to the database, then assign the Recordset to
de QueryTable and then I call the refresh method in order to see the results.

When the refresh is called, the code stops running and begin to recalculate
the formula from where i called de query table.

For example:

=GetData("select * from table1")

This function returns true or false in that cell, but also create a
QueryTable under the cell I wrote the formula.
When QueryTable.Refresh is executed, the code suddenly begin to execute
"GetData" again without finishing the other code, so I get an error.
If I have only one of this formulas in my worksheet, it runs ok because in
the second pass the code is runned entirely, but if i have more formulas the
secuence is the following:

Ex: Formula1, Formula2, Formula2

Formula1 - Is executed until the Refresh method and then pass to the
formula2 without finishing the code of formula1

Formula2 - Is executed until the Refresh method and then pass to the
formula3 without finishing the code of formula3

Formula3 - Finish completely the code and returns ok

Has anyone any idea of what is happening?

Thank you in advance.