Option Explicit Sub Main Dim aiHnd As Long ' First question aiHnd = AI.Ask("Give a SELECT query for all active customers in administration 1.", _ aiSQLCopilot) If aiHnd = 0 Then MsgBox "Submit failed: " & AI.LastErrorMessage, vbCritical Exit Sub End If Do DoEvents Loop Until AI.GetStatus(aiHnd) <> 1 If AI.GetStatus(aiHnd) = 2 Then Debug.Print "--- First answer ---" Debug.Print AI.GetResultStr(aiHnd) End If ' Follow-up question on the same handle aiHnd = AI.Ask("<span style='color: #800080; font-weight: bold;'>Now</span> sort that by last order date, descending.", , aiHnd) If aiHnd > 0 Then Do DoEvents Loop Until AI.GetStatus(aiHnd) <> 1 If AI.GetStatus(aiHnd) = 2 Then Debug.Print "--- Follow-up answer ---" Debug.Print AI.GetResultStr(aiHnd) End If End If AI.CloseHandle aiHnd End Sub
|