MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Importing Specific Fields in Excel to Access


Posted by Pascal on February 21, 2001 10:46 AM

I want to be able to open a host of Excel files, and choose a few specific cells and populate the contents to a MS Access Table. What are the VB commands I will be using?

Thanks for the help.


Posted by Pascal on February 21, 2001 12:42 PM

Private Sub Command0_Click()
Dim Form_2 As Form_Song_Two
Dim S_ID As String
Dim S_Name As String
Dim S_Age As Integer
Dim Excel_Object As Object
Set Excel_Object = GetObject("c:\temp\S_Stuff.xls")
Excel_Object.Windows(1).Visible = False
S_ID = (Excel_Object.Worksheets("Info").Range("F17"))
S_Name = (Excel_Object.Worksheets("Info").Range("F18"))
S_Age = (Excel_Object.Worksheets("Info").Range("L17"))
End Sub

I know so far its taking all the values from the Excel Sheets and is storing them onto the specified variables, but can you help me with the population of an Access Table having the specified field names and properties?

Thanks again.