在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

邱建忠的个人空间 引用 删除 邱建忠   /   2012-08-31 22:36:46
5
引用 删除 zhouyuh   /   2009-11-03 12:56:04
1
 

评分:0

我来说两句

Open Toolbar