Insert and run a query formula

To create a macro add this method into your macro along with the query.

This macro inserts and runs a query formula to a target cell:

Sub InsertAndExecuteQueryFormulaToCell ()
QAAMacro.InsertAndExecuteQueryFormulaToCell "H13","=Infor.QNA_SR(""1,2,SunSystems,LA,F='PK1,K=DbC,F=A,K=/LA/Ldg,F=10000,T=13000,K=/LA/AccCde,F=2005/009,T=2005/009,K=/LA/Prd,E=0,O=/LA/Ldg,E=0,O=/LA/AccCde,E=0,O=/LA/Prd,RT=4154,RF=111111011,AF=1,TP=,"",)"
End Sub

To insert the query to sheets other than the active sheet, change the cell reference from H13 to SheetName!H13.

Caution: 
Ensure that two double quotes are used after the function name, for example: "=Infor.QNA_SR(""..., and at the end of the formula: "",)".

This macro supports all query formulas:

  • Infor.QNA_RL: Reference Link
  • Infor.QNA_SL: Summary Link
  • Infor.QNA_SR: Summary Report
  • Infor.QNA_DR: Detail Report.