We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Private Sub ExportOneTable() 'EXPORTS TABLE IN ACCESS DATABASE TO EXCEL 'REFERENCE TO DAO IS REQUIRED Dim strExcelFile As String Dim strWorksheet As String Dim strDB As String Dim strTable As String Dim objDB As Database 'Change Based on your needs, or use 'as parameters to the sub strExcelFile = "C:\EquipmentDatabase.xls" strWorksheet = "sheet1" strDB = "Z:\Database\Machinery\MachineryDatabase.accdb" strTable = "sheet1" Set objDB = OpenDatabase(strDB) 'If excel file already exists, you can delete it here If Dir(strExcelFile) <> "" Then Kill strExcelFile objDB.Execute _ "SELECT * INTO [Excel 8.0;DATABASE=" & strExcelFile & _ "].[" & strWorksheet & "] FROM " & "[" & strTable & "]" objDB.Close Set objDB = Nothing MsgBox "Exported to C:", , "Done" End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.