none
difference between Querytable.Add and Listobject.Add().QueryTable RRS feed

  • Question

  • Hi,

    I developed my 1st Excel Application Add-In and currently stuck with the following problem. Any advise will be appreciated.

    My QueryTable_afterRefresh does not run after a file is being saved and reopen when it's being written as listobject.Add(SourceType:=Excel.XlListObjectSourceType.xlSrcQuery, Source:=Connection, Destination:=Destination).QueryTable()

    i I do a worksheet.QueryTable.Count it returns 0

    But If I write it as QueryTables.Add(Connection:=Connection, Destination:=Destination, Sql:=query), then QueryTable_AfterRefresh is being run but my Table formatting is missing.

    I'm getting confused between how to link listobject with queryTable so my afterRefresh function will be run when user click on refresh button and also if the file is being saved, reopen and refresh.

    Please help.

    Thanks in advance.

    Monday, April 9, 2012 10:42 PM

All replies

  • Hi lynnnnnn,

    Thanks for posting in the MSDN Forum.

    Would you please tell me your Excel version and Visual Studio version for further research?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, April 11, 2012 8:50 AM
    Moderator
  • Hi lynnnnnn,

    Any update?

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, April 16, 2012 6:18 AM
    Moderator