Option Explicit Sub Main Dim aiHnd As Long aiHnd = AI.Ask("Give a short explanation of the term 'credit limit'.") If aiHnd = 0 Then MsgBox "Submit failed: " & AI.LastErrorMessage, vbCritical Exit Sub End If Do DoEvents Loop Until AI.GetStatus(aiHnd) <> 1 ' 1 = aiStatusBusy If AI.GetStatus(aiHnd) = 2 Then ' 2 = aiStatusReady MsgBox AI.GetResultStr(aiHnd), vbInformation, "AI answer" Else MsgBox "<span style='color: #004080; font-weight: bold;'>Error</span>: " & AI.GetErrorMessage(aiHnd), vbCritical End If AI.CloseHandle aiHnd End Sub
|