| || |
Create a Link and assign it to a variable
I have a very long file path, but I want to use the path and turn it into a link with a shorter name. Is there a function that I can use in QTP to assign it to a variable. In QTP I have something like this:
tagNam = "<A HREF="
path = """http://www.microsoft.com"""
txtmsg = ">Click Here</A>"
hyperlink = tagNam & path & txtmsg
But, when I ran the code I got this in the Result page as follow:
<A HREF="http://www.microsoft.com">This is a hyperlink</A>
But I just want "This is a hyperlink" as a hyperlink.
Does anyone know the work around in getting just the hyperlink instead of seeing the HTML code.
Please share!! [img]images/icons/wink.gif[/img]
Re: Create a Link and assign it to a variable
I tried doing it this way by using the HyperLink function in excel. This is my following code:
'Open excel application
Set OpenExcel = CreateObject("Excel.Application")
'Place cursor to Excel Sheet
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelFormular = "=HYPERLINK("
URLPath = """http://www.microsoft.com"""
txtmsg = """>Click Here</A>"""
Hyperlink = ExcelFormular & URLPath & txtmsg
'Make Excel visible through the Application object.
ExcelSheet.Application.Visible = True
' Place some text in the first cell of the sheet.
ExcelSheet.ActiveSheet.Cells(1,1).Value = HyperLink
'Get HyperLink value
GetTxtMsg = ExcelSheet.ActiveSheet.Cells(1,1).Value
'Close Excel application
' Release the object variable.
Set OpenExcel = Nothing
Set ExcelSheet = Nothing
As a result, it only return the "Click Here" test without a hyperlink.
I even saved the workbook and try to import it to the QTP datatable and keep getting this value in the Column named as "_FUNC_167_". I was confused by this because I this if the datatable can do graphs and math functions, why can't it include the hyperlink function.