代码如下:
Sub ExportExcelFile()
Dim strOut As String
Dim tbl As AccessObject
With Application.FileDialog(4) ' msoFileDialogFolderPicker
.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.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, tbl.Name, strOut & tbl.Name & ".xls"
End If
Next tbl
End Sub
附件示例:
点击下载此附件
演 示: