writing to html file. - TechRepublic
General discussion
August 13, 2013 at 07:13 PM
shaank121

writing to html file.

by shaank121 . Updated 12 years, 10 months ago

myLocation=”C:\Users\Toshiba\ankit\sample.html”

‘mylog=”testddhbf”
‘mystatus=”pass”
sFile=”C:\Users\Toshiba\ankit\log.txt”

Call ToTextFile(myLocation)
Call ToTextFile1(sFile)
Call addHeader(myLocation)

Set objExcel = CreateObject(“Excel.Application”)
Set objWorkbook = objExcel.Workbooks.Open(“C:\Users\Toshiba\ankit\Book1.xlsx”)

intRow = 1

Do Until objExcel.Cells(intRow,1).Value = “”

a = objExcel.Cells(intRow, 1).Value
b = objExcel.Cells(intRow, 2).Value
c = objExcel.Cells(intRow, 3).Value
d= objExcel.Cells(intRow, 4).Value
e = objExcel.Cells(intRow, 5).Value
‘value of second and third parameter in updagelog need to be set post processing of tescase
Call updateLog(myLocation,”Page:Last login container is present”,”pass”, “” & a & “” , “” & b & “”,”” & c & “”,”” & d & “”,”” & e & “”)

intRow = intRow 1

Loop

objExcel.Quit
Call appendToTextFile(sFile, sText)

Function ToTextFile(myLocation)

Set FSO = CreateObject(“Scripting.FileSystemObject”)
Set oFile = FSO.CreateTextFile(myLocation, True)
set FSO=nothing
set oFile=nothing
End Function

Function ToTextFile1(sFile)

Set FSO = CreateObject(“Scripting.FileSystemObject”)
Set oFile = FSO.CreateTextFile(sFile, True)
Set FSO=nothing
set oFile=nothing
End Function

Function appendToTextFile(sFile, sText)

Set FSO1 = CreateObject(“Scripting.FileSystemObject”)
Set oFile1 = FSO1.OpenTextFile(sFile, 8, true)
oFile1.WriteLine (sText)
oFile1.Close
Set FSO = nothing
Set FSO1 = nothing
Set oFile = nothing
Set oFile1 = nothing
Set FSO2 = nothing
Set oFile2 = nothing
End Function

Function addHeader(myLocation)
appendToTextFile myLocation, “

myCaseIdtestcase namestepstobe performedexpectedresultactual result headerLogStatus


End Function

Function updateLog (myLocation, myLog, myStatus,myCaseId,myCaseName,myStep,myExpRes,myActRes)
Dim myPass
Dim myFail
myPass = “ PASSED
myFail = “ FAILED

myVerify = “ PASSED

This discussion is locked

All Comments