SQL SERVER 与ACCESS、EXCEL的数据转换http://www.microsoft.com/china/community/Column/31.mspx
Private Sub Command2_Click() On Error Resume Next CommonDialog1.ShowOpen fln = CommonDialog1.FileName Dim cnn As ADODB.Connection Set cnn = New ADODB.Connection cnn.ConnectionString = "..." cnn.Open Sql = "SELECT * into [excel 8.0;database=" & fln & "].sheet1 from yourtable" cnn.Execute Sql cnn.Close Set cnn = NothingEnd Sub
On Error Resume Next
CommonDialog1.ShowOpen
fln = CommonDialog1.FileName
Dim cnn As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.ConnectionString = "..."
cnn.Open
Sql = "SELECT * into [excel 8.0;database=" & fln & "].sheet1 from yourtable"
cnn.Execute Sql
cnn.Close
Set cnn = NothingEnd Sub