View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
marcell marcell is offline
external usenet poster
 
Posts: 1
Default asynchron querytable refreshing

dear all, my problem is the following:
i'm developping an excel 2007 managed addin but this code segment doesn't
work in an asynchron way ( copied from ThisAddIn class ) :

Dim i_sheet As Worksheet = Me.Application.ActiveWorkbook.ActiveSheet

Try
Dim i_cstring As String = "OLEDB;" &
_editor.cb_sources.ComboBox.SelectedValue
_ActiveQueryTable = i_sheet.QueryTables.Add(i_cstring,
i_sheet.Range("A1"), p_commandText)
_ActiveQueryTable.CommandType = XlCmdType.xlCmdSql
_ActiveQueryTable.BackgroundQuery = True
_ActiveQueryTable.Refresh()

Catch ex As Exception
MsgBox(ex.Message)
End Try

it works fine but the application (excel) doesn't remain responsive, have to
wait till the db sends back the resultset. Could somebody help me?
thanks in advance,
m