QTP VBScript new series + Interview Question Bank on QTP for enrichment of Knowledge in QTP

This Site has been brought to you by HP Certified Expert of QTP.

Exciting new articles for October:

1) QTP Tip:Deselect all Radio Buttons

2) HP QTP Crypt Object

3)Adding Hyperlinks in Excel Spreadsheet

Best of Luck Friends ! ! !

Expert QTP

All Articles are Copyright Protected. These are Free for Reading & Personal Use. Reproduction in Any Form without the Permission is Illegal & Strictly Prohibited.

Copyright © 2009 ExpertQTP

Google Search

Sunday, October 4, 2009

QTP: Adding Hyperlinks in Excel Spreadsheet

I was playing with the excel application along with QTP when suddenly I thought of adding a hyperlink inside an Excel spreadsheet from Quicktest. Task seemed a bit tricky initially but I took up the challenge and finally created a script.

The QTP script to accomplish the same goes here:

'Create an object reference to Excel. Also you can see "Excel.exe" 'process gets created in the Task Manager
Set objExcel = CreateObject("Excel.Application")

'Make the invisible Excel application visible
objExcel.Visible = True

'Add a workbook to the blank excel sheet
Set objWorkbook = objExcel.Workbooks.Add

'Get the handle of first sheet
Set objWorksheet = objWorkbook.Worksheets(1)

'Enter the value in A1 cell inside your first worksheet
objWorksheet.Cells(1, 1) = "QTP Expert"

'Create a range encompassing only the single cell A1
Set objRange = objExcel.Range("A1")

'Add a hyperlink to that range. Here range is only a single 'cell so hyperlink would be created
Set objLink = objWorksheet.Hyperlinks.Add _
(objRange, "")

If you like this Article, I would suggest you to subscribe my RSS feed. This way you will get all new future articles directly into your mailbox.

No comments:

Copyright © 2009 ExpertQTP