Advertisement

05.14.2008 at 03:07PM PDT, ID: 23403356
[x]
Attachment Details

How to prompt for an Excel spreadsheet to import into a table

Asked by JoeFletcher in Access Coding/Macros, Microsoft Access Database, Visual Basic Programming

Tags: Visual Basic for Applications, VBA

I'm working in Access and playing with VBA.  I want a user to click a button, have the file open dialog open, they select a spreadsheet, and then it imports into a table.  The problem is the filename can be different every time.  The table name will remain constant.  I think it's something along the lines of below, but I don't know how to create a "variable?".Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
Private Sub ImportSpreadsheet_Click()
On Error GoTo Err_ImportSpreadsheet_Click
 
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Cleaning", "Choose your spreadsheet dialog", Yes
 
Exit_ImportSpreadsheet_Click:
    Exit Sub
 
Err_ImportSpreadsheet_Click:
 
    Resume Exit_ImportSpreadsheet_Click
    
End Sub
[+][-]05.14.2008 at 03:26PM PDT, ID: 21569243

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Coding/Macros, Microsoft Access Database, Visual Basic Programming
Tags: Visual Basic for Applications, VBA
Sign Up Now!
Solution Provided By: capricorn1
Participating Experts: 2
Solution Grade: A
 
 
[+][-]05.14.2008 at 03:33PM PDT, ID: 21569270

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.14.2008 at 03:34PM PDT, ID: 21569278

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628