将查询结果导出到Excel的另一个方法 发表时间:2004-8-10作者:未知[获得此文档时候没有作者记录,深感抱歉,本文档全为转载] Option ExplicitDim dbado As New ADODB.ConnectionDim cmdado As New ADODB.CommandDim sqlstr As StringDim howdo As StringDim filename As String Private Sub command1_click()filename = App.Path & "/" & InputBox("输入新文件名:", "保存") & ".xls"howdo = Text1.Text dbado.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "/goods.mdb;Persist Security Info=False") sqlstr = "SELECT * INTO [Excel 5.0;DATABASE=" & filename & "].[data] FROM [basic] where id in (" & howdo & ")" dbado.Execute (sqlstr), , adCmdText + adExecuteNoRecords dbado.close end sub 中国.Net俱乐部转载此文。让我们一起进步,共享人类技术资源。[www.chinaaspx.com]