Private Sub excelout() '输出逗号分隔符文件 Dim headline As String Dim textline As String Dim rs As Recordset Dim adk As Adodc textout = "" headline = "" Set adk = DataGrid1.DataSource If adk Is Nothing Then Exit Sub Set rs = adk.Recordset a = rs.Fields.Count For i = 0 To a - 1 If TypeName(rs.Fields(i).Name) <> "String" Then b = Str(rs.Fields(i).Name) Else b = rs.Fields(i).Name End If headline = headline + b + "," Next i headline = headline + vbCrLf Do While adk.Recordset.EOF = False For i = 0 To a - 1 If IsNull(rs.Fields(i).Value) = True Then b = " " Else If TypeName(rs.Fields(i).Value) <> "String" Then b = Str(rs