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.
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 |
What is hyperlink?
What do you mean by Databound Controls? Explain.
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
How do I add a form in visual basic?
Types of DBCombo boxes
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
How would you view html code in Active Server Pages?
Recordset object consists what?
Binary Access-method is used to access file in which manner?
Difference between Recordset and Resultsets.
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).
What is the use of Active Control Property?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)