Last Comment

replica watches,breitling,cartieris a ...

2010-03-03 @ 12:42:51 pm
by rolex


replica watches,rolex watches,replica ...

2010-03-03 @ 12:41:12 pm
by rolex


How to get the Browser window ...

2008-11-20 @ 12:41:11 pm
by venugopal


there are many problems we will ...

2008-07-16 @ 03:58:49 pm
by Ramu


what r the challenges have faced ...

2008-07-15 @ 10:57:24 am
by veerachary


Calendar

February 2010
SunMonTueWedThuFriSat
 << < > >>
1234567
891011121314
15161718192021
22232425262728

Announce

Who's Online?

Member: 0
Visitor: 1

Choose a skin



Links

    RAMU PALANKI
    VB Scritp for Comparing two Excels

    Use the below code to compare Two Excel files data
    Keep the below code in .vbs file and just double click on the .vbs.
    provide path of the excel files with extension .xls
    you can run the below script both in .vbs as well as in QTP Script
    ---------------------------------------------------------------------
    ExcelFilePath1 = InputBox("Please Enter the Path of first Excel File")
       Set fso = CreateObject("Scripting.FileSystemObject")
       If (fso.FileExists(ExcelFilePath1) = false )Then
       msgbox  ExcelFilePath1 & " doesn't exist."
    wait(2)
       wscript.quit
       End If

    ExcelFilePath2 = InputBox("Please Enter the Path of second Excel File") 
    If (fso.FileExists(ExcelFilePath2) = false )Then
       msgbox  ExcelFilePath2 & " doesn't exist."
       wscript.quit
    End If

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = false
    Set objWorkbook1 = objExcel.Workbooks.Open(ExcelFilePath1)
    Set objWorkbook2 = objExcel.Workbooks.Open(ExcelFilePath2)
    Set objWorksheet1= objWorkbook1.Worksheets(1)
    Set objWorksheet2= objWorkbook2.Worksheets(1)
    For Each cell In objWorksheet1.UsedRange
         If cell.Value <> objWorksheet2.Range(cell.Address).Value Then
        'Highlights in green color if any changes in cells (for the first file)
               cell.Interior.ColorIndex = 4
     'Highlights the same cell in the Second file
     objWorksheet2.range(cell.Address).interior.colorIndex = 4                 
     Else
           cell.Interior.ColorIndex = 0

      End If

    Next
    ObjExcel.displayAlerts = False 
    objExcel.Save
    objExcel.quit
    set objExcel=nothing
    msgbox "It is Done"



    Let me know if any you get error while trying to execute the same

    12:29:53 pm . 16 Jul 2008
    Ramu · 68 views · 0 comments
    Categories: Compare Excels

    Permanent link to full entry

    http://ramupalanki.shared-blogs.com/Automation-b1/VB-Scritp-for-Comparing-two-Excels-b1-p21.htm

    Comments

    No Comment for this post yet...


    Leave a comment

    New feedback status: Published





    Your URL will be displayed.

     
    Please enter the code written in the picture.


    Comment text

    Options
       (Set cookies for name, email and url)