Selecting and Importing Excel file and sheet for import into Access
DRANK

IntroductionA common requirement in Microsoft Accessis the ability to import files. Compared to working with C# and Visual Basic.Net, this is somewhat different.ImplementationThe first requirement is to be able to browse to the Excel file. Here is the code that is executed in the form when the “Browse” button is clicked:Private Sub buttonBrowse_Click() ' Clear out existing information before browse Dim itemsString As String textBoxExcelFileToImport = "" listBoxWorksheets.RowSource = "" subFormData.Visible = False DoEvents ' Allow user to browse to Excel file to import textBoxExcelFileToImport = GetExcelFile If IsNull(textBoxExcelFileToImport) Then Exit Sub ' Fill in list box that will contain the sheet names itemsString = Join(ExcelSheetsNameList(textBoxExcelFileToImport), ";") listBoxWorksheets.RowSource = itemsString End SubThis code first clears out information in the form that may be applicable to the last file that was sel…

codeproject.com
Related Topics: Excel Microsoft Access C#