在EXCEL里面添加超联接(hyperlink)的方法
上一篇 /
下一篇 2006-12-12 10:35:58
/ 个人分类:QTP
Sub ReportInformation(filename)
' create the Excel object
Set ExcelObj = CreateObject("Excel.Application")
' add a new Workbooks and a new Sheet
ExcelObj.Workbooks.Add
Set NewSheet = ExcelObj.Sheets.Item(1)
NewSheet.Name = "Page Information"
' customize the Sheet layout
NewSheet.Cells(1,1).Value = "Tom"
NewSheet.Cells(2,1).Value = "Sohu"
NewSheet.Hyperlinks.Add NewSheet.Cells(1,1), "http://www.tom.com/"
NewSheet.Hyperlinks.Add NewSheet.Cells(2,1), "http://www.sohu.com/"
' save the Excel file
ExcelObj.ActiveWorkbook.SaveAs filename
' close the application and clean the object
ExcelObj.Quit
Set ExcelObj = Nothing
End Sub
call ReportInformation("c:\test.xls")
收藏
举报
TAG:
QTP