Private Sub Form_Load()
ExportExcelSheetToAccess "Sheet1", "C:\Book1.xls", _ "TestTable","C:\Yams\bhar.mdb" End Sub Private Sub ExportExcelSheetToAccess(sSheetName As String, _ sExcelPath As String, sAccessTable As String, _ sAccessDBPath As String) Dim dbAs Database Dim rsAs Recordset Set db = OpenDatabase(sExcelPath, True, False, _ "Excel 5.0") Call db.Execute("Select * into [;database=" & _ sAccessDBPath & "]." & sAccessTable & _ " FROM [" & sSheetName & "$]") MsgBox "Tabella esportata.", vbInformation End Sub Richiede le referenze di DAO sul progetto Inputs: 1. Excel Sheet name(eg. Sheet1) [Source sheet to beexported] 2. Excel Workbook path(eg. C:\book1.xls) [Source work book containing the sheet] 3. Excel Sheet name(eg. TestTable) [Destination table name] 4. Excel Workbook path(eg. C:\Yams\bhar.mdb") [Destination databasepath] Returns: Table in Microsoft Access Database Assumes: He has to know the DAO funtion of how to open a Database |