Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

how to convert this vbscript into jscript?

$
0
0

Public Function ReadExcelDataSingle(sFileName,iRow,sFieldName,vSheet)
//Option explicit
Dim sData
Dim iNoError
Dim sCurrentProc
Dim sWinDir
Dim lResult
Dim strMsgText
Dim iColNum
Dim sTestData
Dim ColHead

//Count Columns
ColCount = objWorkSheet.UsedRange.columns.count

set oSearchRegion = objWorkSheet.Range(objWorkSheet.cells(1,1),objWorkSheet.cells(1, ColCount ))
notfound = ""
with (oSearchRegion)
set oSearchResult = .Find(sFieldName)
If not oSearchResult is nothing then
iColNum = oSearchResult.column
FirstCol = iColNum
FoundVal = objWorkSheet.Rows(1).Columns(iColNum).Value
If sFieldName != FoundVal then
do
set oSearchResult = .Findnext(oSearchResult)
iColNum = oSearchResult.column
FoundVal = objWorkSheet.Rows(1).Columns(iColNum).Value
loop while FirstCol != iColNum and sFieldName != FoundVal
if sFieldName != FoundVal then notfound = "Y"
end if
else
notfound = "Y"
end if
End With

//Retrieve the value from the cell
sData = ""
if notfound = "" then
sData =objWorkSheet.rows(iRow).Columns(iColNum).Value
end if

sData = Trim(sData)

ReadExcelDataSingle = sData

End Function


Viewing all articles
Browse latest Browse all 21061

Trending Articles