先多谢各位大虾

解决方案 »

  1.   

    dim ex as object
    dim exbook as object
    dim exsheet as object
    dim a(255) as string 
    set ex=createobject("excel.application")
    ex.visible=true
    set exbook=nothing
    set exsheet=nothing
    set exbook=ex.workbooks.add
    set exsheet=exbook.worksheets("sheet1")
    ex.range("a1")=text1.text & vbcrlf
    ex.Range("A1") = Left(ex.Range("A1"), Len(ex.Range("A1")) - 2)
      

  2.   

    打印你可以利用excel中的打印方法
      

  3.   

    Dim cn as Adodb.Connection
    Dim rs as Adodb.Recordset
    Dim xlApp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim xlSheet As Excel.Worksheet数据库连接,查询Set xlApp = CreateObject("Excel.Application")
    Set xlBook = xlApp.Workbooks.Add
    Set xlSheet = xlBook.Worksheets(1)'//将数据填充至EXCEL中
    Dim iCurrentRow,iCurrentCol,i as integer
    iCurrentRow =1:iCurrentCol =1 
    For i = 0 to rs.Fields.Count - 1
      xlsheet.cells(iCurrentRow,iCurrentCol) = rs.Fields(i).Name
      iCurrentCol = iCurrentCol + 1
    NextiCurrentRow = iCurrentRow+1:iCurrentCol =1
    Do While Not rs.Eof
       For i = 0 to rs.Fields.Count - 1
         xlsheet.cells(iCurrentRow,iCurrentCol) = rs.Fields(i).Value
         iCurrentCol = iCurrentCol +1
       Next
       iCurrentRow = iCurrentRow+1:iCurrentCol =1
       rs.Movenext
    Loop'//打印
    xlSheet.PrintOut
    Set xlSheet = Nothing
    Set xlBook = Nothing
    '如要自动关闭EXCEL,请加入 xlApp.Quit
    Set xlApp = Nothing
      

  4.   

    stonegoldaustin(特纯中南海): 我用你的方法,速度很慢呀,600多条记录,花了40多秒,datagrid里的记录一条一条往下走,走到底才算完成
      

  5.   

    http://www.csdn.net/develop/read_article.asp?id=14952