iam trying to export the data in to an excel file. Iam using GetLastError for this. Iam inserting "Pass" or "Fail" in the data table . but it is not taking it correctly.
The code is as follows:

iErr = GetLastError
If iErr <> 0 Then
teststatus = "Pass"
teststatus = "Failed"
end if

datatable.Value ("Result" ,"Global") = teststatus

It is not updating the datatable as expected. iam expoting the datatable. It is giving all the events as Failed or pass depending on the result of the last file. Please help.