如何将数据库的内容写到特定的Excel中,而且让特定的Excel文件不显示。

解决方案 »

  1.   

    你说得不清楚。
    数据库的内容写到Excel中不难,特定的Excel是指定的Excel文件吗?你先打开这个文件,让它在后台运行,这样就不显示了。然后从数据库中读取数据再写向Excel。具体的细节,可以在论坛中用Excel关键字查询。
      

  2.   

    特定的Excel是指定的Excel文件,如a.xls。如何实现让它在后台运行?从ACCESS数据库如何写到a.xls中,我是一个新手,不太了解,请赐教。
      

  3.   

    Dim tempxlApp As New Excel.Application
        Dim tempxlWorkbook As New Excel.Workbook
        Dim tempxlSheet As New Excel.Worksheet
        Dim cmSe As ADODB.Command    Dim strXlsName As String           'Excel 文件名
        Dim strSheet As String             '表名
        Dim strPcode As String             '产品编号
        Dim strTmp As String
        Dim i As Integer    Set cmSe = New ADODB.Command
        cmSe.ActiveConnection = cn
        cmSe.CommandType = adCmdText    strXlsName= app.path & "\Book1.xls"
       '打开Excel 文件
        Set tempxlWorkbook = tempxlApp.Workbooks.Open(strXlsName)
        tempxlApp.DisplayAlerts = False
        Set tempxlSheet = tempxlWorkbook.Worksheets("Sheet1")
        tempxlSheet.Select
        
        For i = 1 To 50
            strPcode = tempxlSheet.Cells(i, 5)
            iNum = tempxlSheet.Cells(i, 17)
            '把记录添加到EachDay表中
            strTmp = "Insert into EachDay (cInvCode,iCount) VALUES('" & strPcode & "'," & iNum & ")"
            cmSe.CommandText = strTmp
            cmSe.Execute
        Next i
        
        '释放对象,关闭excel
        Set tempxlSheet = Nothing
        Set tempxlWorkbook = Nothing
        tempxlApp.Quit
        Set tempxlApp = Nothing
      

  4.   

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