After Hours

General discussion


writing to html file.

By shaank121 ·
Tags: Off Topic


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


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)
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, "<Table Border = 1><TR><TD WIDTH = 40>myCaseId</TD><TD WIDTH = 20>testcase name</TD><TD WIDTH = 40>stepstobe performed</TD><TD WIDTH = 40>expectedresult</TD><TD WIDTH = 40>actual result header</TD><TD WIDTH = 40>Log</TD><TD WIDTH = 40>Status</TD></TR></Table>"
End Function

Function updateLog (myLocation, myLog, myStatus,myCaseId,myCaseName,myStep,myExpRes,myActRes)
Dim myPass
Dim myFail
myPass = "<font color = green> PASSED <font color = black>"
myFail = "<font color = red> FAILED <font color = black>"

myVerify = "<font color = green> PASSED <font color = black>"

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Is this a question?

by robo_dev In reply to writing to html file.

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.

Related Discussions

Related Forums