将所有的表,用VBA批量导出成CSV格式文件。
代码:
Sub ExportCSV()
Dim strOut As String
Dim tbl As AccessObject
With Application.FileDialog(4)
.Title = 'Please select the target folder'
If .Show Then
strOut = .SelectedItems(1)
If Not Right(strOut, 1) = '\' Then
strOut = strOut & '\'
End If
Else
MsgBox 'You didn't select a target folder.', vbExclamation
Exit Sub
End If
End With
For Each tbl In CurrentData.AllTables
If Not tbl.Name Like 'MSys*' And Not tbl.Name Like '~' Then
DoCmd.TransferText acExportDelim, , _
tbl.Name, strOut & tbl.Name & '.csv', True
End If
Next tbl
End Sub
联系客服