Hi rags,

q>How to fill color for a cell  Ex: if TC is passed then fill cell with
green color & fail with Red color ?
Sol:>



Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(strResultSheetLocation)
Set objWorkSheet = objWorkbook.Worksheets(intSheetNumber)
objWorkSheet.Activate
For iCount = 0 to (UBound(arrResultData)-1)
        objWorkSheet.Cells(objExcel.ActiveCell.Row, sColumnId).Value =
Trim(arrResultData(iCount))
        If iCount = 0 Then
        objExcel.Cells(objExcel.ActiveCell.Row, sColumnId).Font.Bold = True '
use for Bold face
        objExcel.Cells(objExcel.ActiveCell.Row,
sColumnId).HorizontalAlignment = xlCenter 'Use for Horizontal
Alignment
                objExcel.Cells(objExcel.ActiveCell.Row, 
sColumnId).VerticalAlignment
= xlCenter       'Use for Vertical Alignment
                If InStr(LCase(arrResultData(iCount)),"pass") <> 0 Then
                        objExcel.Cells(objExcel.ActiveCell.Row, 
sColumnId).Interior.ColorIndex = 35
                ElseIf InStr(LCase(arrResultData(iCount)),"fail") <> 0 Then
                        objExcel.Cells(objExcel.ActiveCell.Row, 
sColumnId).Interior.Color =
RGB(255,128,128) 'Color Code
                End If                          
        End If
        sColumnId = sColumnId + 1
Next


I think this would be solve ur problem.

thanks
Sujit

On 4/16/12, Deepak Kumar Mahapatro <[email protected]> wrote:
> if you can manually set the iterationmode to single iteration then ignore
> the AOM statements.
>
> On Mon, Apr 16, 2012 at 6:43 PM, Deepak Kumar Mahapatro <
> [email protected]> wrote:
>
>> Set qtApp=GetObject("", "QuickTest.Application")
>> qtApp.Test.Settings.Run.IterationMode="oneIteration"
>> intRowCount=DataTable.GetSheet(<SheetID>).GetRowCount
>> intFailCounter=0
>> intPassCounter=0
>> For intCounter=1 To intRowCount
>> DataTable.SetCurrentRow intCounter
>> If DataTable(<AttributeID>, <SheetID>)="Pass" Then
>>  intPassCounter=intPassCounter+1
>> Elseif DataTable(<AttributeID>, <SheetID>)="Fail" Then
>>  intFailCounter=intFailCounter+1
>> End If
>> Next
>> MsgBox intFailCounter
>> MsgBox intPassCounter
>> Set qtApp=Nothing
>>
>> use this code after completion of all testcases
>>
>> On Mon, Apr 16, 2012 at 6:10 PM, Deepak Kumar Mahapatro <
>> [email protected]> wrote:
>>
>>> while exporting from datatable it exports only data not the styles we
>>> applied in excel sheet but it imports those.
>>> and before exporting the result you can count the no. of pass and no. of
>>> fails
>>>
>>>
>>> On Mon, Apr 16, 2012 at 10:04 AM, rags <[email protected]> wrote:
>>>
>>>> Hi All,
>>>>
>>>> Using parameterization concepts m trying to check the log in page,
>>>> below is the script
>>>>
>>>>
>>>> datatable.AddSheet "Login page parameterization-DMX"
>>>> datatable.ImportSheet "D:\Rag's\DMX\Automation testing scripts
>>>> \Automation test plan.xls",2,3
>>>> Datatable.ImportSheet "D:\Rag's\DMX\Automation testing scripts
>>>> \Automation test plan.xls",1,4
>>>> Datatable.ImportSheet "D:\Rag's\DMX\Automation testing scripts
>>>> \Automation test plan.xls",3,5
>>>> rc=datatable.GetSheet(3).GetRowCount
>>>> 'msgbox rc
>>>>
>>>> For i=1 to rc
>>>>    datatable.GetSheet(3).SetCurrentRow(i)
>>>>        systemutil.Run ""
>>>>
>>>>        wait(20)
>>>>
>>>>        Browser("DMX Admin").Page("Login
>>>> page").WebEdit("txtUserName").Set
>>>> datatable("UN",3)
>>>>        Browser("DMX Admin").Page("Login
>>>> page").WebEdit("txtPassword").Set
>>>> datatable("PASSWORD",3)
>>>>        Browser("DMX Admin").Page("Login page").Image("Login").Click
>>>>
>>>>        wait(10)
>>>>
>>>>    If Browser("DMX Admin").Page("Control panel").Image("User
>>>> Manager").exist  Then
>>>>                Datatable("ACTUALRESULT",3)="Pass"
>>>>        else
>>>>                Datatable("ACTUALRESULT",3)="Fail"
>>>>        End If
>>>>
>>>>     If Datatable("ACTUALRESULT",3)="Pass" Then
>>>>                                  Datatable("STATUS",3)="Pass"
>>>>        else
>>>>                                  Datatable("STATUS",3)="Fail"
>>>>        End If
>>>>
>>>>
>>>>   If Browser("DMX Admin").Exist Then
>>>>           Browser("DMX Admin").Close
>>>>  End If
>>>>
>>>> Next
>>>>
>>>> Datatable.ExportSheet "D:\Rag's\DMX\Automation testing scripts
>>>> \Automation test plan-result.xls",3
>>>> datatable.ExportSheet "D:\Rag's\DMX\Automation testing scripts
>>>> \Automation test plan-result.xls",4
>>>> datatable.ExportSheet "D:\Rag's\DMX\Automation testing scripts
>>>> \Automation test plan-result.xls",5
>>>>
>>>>
>>>> Here i need script to count the total number of Test cases passes &
>>>> Failed ?
>>>> How to fill color for a cell  Ex: if TC is passed then fill cell with
>>>> green color & fail with Red color ?
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> "QTP - HP Quick Test Professional - Automated Software Testing"
>>>> group.
>>>> To post to this group, send email to [email protected]
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/MercuryQTP?hl=en
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Deepak
>>>
>>
>>
>>
>> --
>> Regards,
>> Deepak
>>
>
>
>
> --
> Regards,
> Deepak
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>


-- 
Thanks & Regards
Sujit

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en

Reply via email to