Discussion Locked

writing to html file.

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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, "

myCaseId testcase name stepstobe performed expectedresult actual result header Log Status

"
End Function

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

myVerify = " PASSED "

1 reply

by robo_dev

It looks like you're writing the output to a text file.

Is that VB?

I think the webbrowser.document.write function may be useful for your code.

The lazy approach would have excel create the Html with the data within the spreadsheet, then just use VB to grab the file from Excel.

This discussion is closed to new replies.