@Subz is certainly right. The Sample.txt is missing or empty. On the other PC it is present, therefore no error message appears.
Here is a runable test version with extended error messages. Since you did not include an example of a Sample.txt, I created one myself for testing purposes.
#include <File.au3>
#include <String.au3>
#include <Array.au3>
Global $vfile
CheckTemp()
Func CheckTemp()
;$vfile = "C:\Users\Username\Desktop\Sample.txt"
$vfile = @ScriptDir & "\Sample.txt" ; ; *** only for test
Local $aFile, $aFinal[0], $iError, $sErrorMessage
_FileReadToArray($vFile, $aFile)
$iError = @error
If $iError <> 0 Then
Switch $iError
Case $iError = 1
$sErrorMessage = "Error : Opening specified file"
Case $iError = 2
$sErrorMessage = "Error : Unable to split the file"
Case $iError = 3
$sErrorMessage = "Error : File lines have different numbers of fields"
Case $iError = 4
$sErrorMessage = "Error : No delimiters found"
Case Else
$sErrorMessage = "undefined error : "
EndSwitch
Exit MsgBox(BitOR(4096, 16), "Error", $sErrorMessage & @CRLF)
EndIf
_ArrayDisplay($aFile, "aFile :") ; *** only for test
For $i = 1 to $aFile[0]
$sTemp = _StringBetween($aFile[$i], "Temperature", "Celcius")
If $sTemp <> 0 Then _ArrayAdd($aFinal, $sTemp)
Next
_ArrayDisplay($aFinal, "aFinal :") ; *** only for test
;~ If $aFinal[0] > 40 Then
;~ $oOApp = ObjCreate("Outlook.Application")
;~ $oOMail = $oOApp.CreateItem ($olMailItem)
;~ $oOMail.Save
;~ ;With $oOMail
;~ ;.To = ($to)
;~ ;.;Subject = $subj
;~ ;.Importance= $olImportanceHigh
;~ ;.HTMLBody = &body
;~ ;.attachments.add ("")
;~ ;.Send
;~ ;EndWith
;~ MsgBox($MB_SYSTEMMODAL, "Current Temperature", $aFinal[0], 2)
;~ EndIf
;~ $oOApp=0
;~ FileClose($vfile)
EndFunc
sample.txt