vbExcel

来源:互联网 发布:钢笔字帖推荐 知乎 编辑:程序博客网 时间:2024/06/06 04:29

Dim vbExcel As Excel.Application

Dim wsheet As Worksheet

Dim i As Long

    Set vbExcel = CreateObject("Excel.Application")

    strPath = "C:/Documents and Settings/Administrator.ICBCOA-F9B65DD3/桌面/所有用户.xls"

    vbExcel.Workbooks.Open (strPath)

    Set wsheet = vbExcel.Worksheets(1)

    While wsheet.Cells(i + 2, 1).Value <> ""

        strS1 = wsheet.Cells(i + 2, 1).Value

        strS2 = wsheet.Cells(i + 2, 3).Value

 i = i + 1

 Wend

    Set wsheet = Nothing

    vbExcel.Workbooks.Close

    Set vbExcel = Nothing  
原创粉丝点击