Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
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.