Hi,
I am USINg QTP tool for automation. Where VB Script have to
use. I want to read a row from the table present in .Doc
File and to paste in excel. Could you please assist me or
give me the code to get it. I am new in this technology.



Hi, I am USINg QTP tool for automation. Where VB Script have to use. I want to read a row from th..

Answer / Navraj Singh Dharmshktu

To read data from a Word document and write it into an Excel file using QTP (QuickTest Professional) and VBScript, you can use the following steps:
1. Load Microsoft Word Application.
2. Open the desired Word Document.
3. Find the table you are interested in and get its reference.
4. Iterate through the rows of the table and extract the required data using 'Cell(rowNumber, columnNumber)' function.
5. Create a new Excel workbook or open an existing one.
6. Select the destination cell where you want to write the extracted data.
7. Write the data into the Excel cell using 'WriteExcel' function.nHere is a sample code:n```vbnSet IE = Browser("IE").GoToURL("http://yoururl.com/document.doc")nSet AppWord = CreateObject("Word.Application")nSet DocWord = AppWord.Documents.Open("D:document.doc")nSet TabWord = DocWord.Tables(1)nFor i = 1 To TabWord.Rows.CountnFor j = 1 To TabWord.Columns.CountnstrData = strData & TabWord.Cell(i,j).Text & " "nNext jnNext inSet AppExcel = CreateObject("Excel.Application")nSet WbkExcel = AppExcel.Workbooks.Add()nSet ShtExcel = WbkExcel.ActiveSheetnShtExcel.Cells(1, 1) = strDatanAppWord.Quit()nAppExcel.Visible = Truen```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Visual Basic Interview Questions

What is hyperlink?

1 Answers  


What do you mean by Databound Controls? Explain.

1 Answers  


how to validate the pop up window Example :assume there is an webpage in that webpage we had a button to browser or file to upload . how to validate this button if we click on that botton window should appear else back to the page i need in VB Script Code since i am using QTP for testing

1 Answers   Sapient,


How do I add a form in visual basic?

1 Answers  


Types of DBCombo boxes

1 Answers  


1.What are the Feactures visual data manager 2.Short note on visual data manager 3.What is data control,its work,properties,methods 4.Needs for OLEDB in vb 5.LIst steps involved in generating christal report 6.What is a recordset 7.Diffrence between RDO and ADO 8.What is an Activex control 9.Advantages of ADO over data control 10.Diffrence between model and modeless form 11.What is the significance of debug window 12.Diffrence between single document and multiple document 13.Explain data report

1 Answers   Microsoft,


How would you view html code in Active Server Pages?

1 Answers  


Recordset object consists what?

1 Answers  


Binary Access-method is used to access file in which manner?

1 Answers  


Difference between Recordset and Resultsets.

1 Answers  


i want to retrive data from one spead sheet to another UI (workbook). control will search cell by cell for each row and load the data in another workbook(UI).

1 Answers   Nissan, TechSoft,


What is the use of Active Control Property?

1 Answers   HCL,


Categories