请问如何读写EXCEL表中的数据

解决方案 »

  1.   

    Dim xlteachder As New Excel.Application
    Dim xlBook As New Workbook
    Dim xlSheet As New Worksheet
    Set xlteachder = CreateObject("excel.application")
    xlteachder.Visible = False/true 是否可见
    Set xlBook = xlteachder.Workbooks.Open(地址)
    Set xlSheet = xlBook.Worksheets(1)
    xxxx=xlSheet.Cells(1,1)Value 就是第一行地一列的值
    xlSheet.Cells(1,1)Value=xxxx  也可以赋值
    xlBook.Save  改变以后一定要保存
    xlteachder.Quit
    xlteachder.Workbooks.Close  '关闭进程
      

  2.   

    Dim ExcelApp As Excel.Application
    Dim ExcelBook As Excel.Workbook
    Dim ExcelSheet As Excel.Worksheet
    Set ExcelApp = CreateObject("excel.application") '创建EXCEL句柄
    ExcelApp.Visible = False '
    Set ExcelBook = ExcelApp.Workbooks.Add '创建EXCEL工作薄
    Set ExcelSheet = ExcelBook.Worksheets(1) '创建EXCEL工作表
    ExcelSheet.Cells(1, 1).Value = "编号"
    ExcelSheet.Cells(1, 2).Value = "单位名称"
    ExcelSheet.Cells(1, 3).Value = "负责人"
    ExcelSheet.Cells(1, 4).Value = "单位地址"
    ExcelSheet.Cells(1, 5).Value = "类别"
    ExcelSheet.Cells(1, 6).Value = "许可项目"
    ExcelSheet.Cells(1, 7).Value = "区域"
    ExcelSheet.Cells(1, 8).Value = "乡镇"
    ExcelSheet.Cells(1, 9).Value = "发证日期"
    ExcelSheet.Cells(1, 10).Value = "截止日期"
    ExcelSheet.Range("A2").CopyFromRecordset rsExcelBook.SaveAs strExcelPath + "临时卫生许可证报表"
    ExcelApp.Visible = True
      

  3.   

    呵呵,我来错了~~~delphi中的读写我到可以帮你!~~~
    vb正在学习,关注中!~~~
      

  4.   

    delphi 也要啊我也正在学啊