发布新日志

  • QTP向EXCEL中写数据

    2008-09-11 17:04:27

        Dim xlApp
            Dim xlBook
            Dim xlSheet
            Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象

            Set xlBook = xlApp.Workbooks.Open("c:\test.xls") '打开已经存在的EXCEL工件簿文件

            xlApp.Visible = True '设置EXCEL对象可见(或不可见)

            Set xlSheet = xlBook.Worksheets("sheet1") '设置活动工作表
      xlsRowCount = xlSheet.UsedRange.Rows.Count

            xlsColumnCount = xlSheet.UsedRange.Columns.Count

     
       For i=xlsRowCount+1  to 100
        For j=0   to 100
                          xlSheet.Cells(i, j) =200 '给单元格(row,col)赋值
        Next
     Next
           


            xlBook.Close (True) '关闭工作簿

            xlApp.Quit '结束EXCEL对象

            Set xlApp = Nothing '释放xlApp对象

     

  • QTP读取EXCEL中的数据

    2008-09-11 11:28:15

    'MODULE DEscrīptION:
    'USER:
    'GOLBAL FUNCTIONS AND VARIABLES DEFINED IN THIS MODULE:
    '
    'Date        Who      Rev             Comment
    '-----------------------------------------------------------------
    '
    '
    '******************************************************************
     Set excelapp=createobject("excel.application")
     Set excelbook=excelapp.workbooks.open("c:\test.xls")
     Set excelsheet=excelbook.worksheets("sheet1")
    For i=1 to 4
     For j=1 to 2
     testno1=cstr(excelsheet.cells(i,j))
     msgbox (testno1)
     Next
    Next
  • 开通自己的日志

    2008-09-11 11:24:20

    不为别的,只是因为最近准备要换工作了,要把工作中遇到备忘录记下来

我的栏目

我的存档

数据统计

  • 访问量: 1244
  • 日志数: 3
  • 建立时间: 2008-09-11
  • 更新时间: 2008-09-11

RSS订阅

Open Toolbar