Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to import multiple sheet of excel into Access database to a diffrent tables??

Hello
i am lookinng some unsocumented feture (earlier) of EXCEL,ACCESS to
achive the following functionality.

1. Excel file is having multiple sheets say 10:
2. i want to download all the data into an Access database
3. output should have sheetname--tablename.

I tried the below code (Which was an undocumented earlier)

DoCmd.TransferSpreadsheet transfertype:=acImport, _
tablename:="tblsheet1", _
FileName:="A:\exceldata\excelbook1to10.xls",
Hasfieldnames:=False, _
Range:="Sheet1!", SpreadsheetType:=9

When i executed from the VBA code, it is displaying the following
error,
Thanks in advance.
baka@tokyo
japan

Execution error
Worksheet format variable value is not correct... etc(translated from
japanese )

Does any one show me the way to get all the sheet should becomes
tables in access

Here is the code i was using in VBE (part of the code is changed for
web viewing purpose)

------------------------------------------
Private Sub import_Click()
catlog.ActiveConnection = CurrentProject.Connection

For Each tble In catlog.Tables
If tble.Name = "table001" Then
MsgBox "table001 allreday exists", vbOKOnly +
vbInformation, "confirm please"
Exit Sub
End If
Next tble
, the below 5 lines code is giving an error
DoCmd.TransferSpreadsheet transfertype:=acImport, _
tablename:="tblsheet1", _
FileName:="A:\exceldata\excelbook1to10.xls",
Hasfieldnames:=False, _
Range:="Sheet1!", SpreadsheetType:=9


'
' the below code working for a first sheet
' For Each tble In catlog.Tables
' If tble.Name = "table001" Then
' MsgBox "table001 allreday exists", vbOKOnly +
vbInformation, "confirm please"
' Exit Sub
' End If
' Next tble
' DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9,
"table001", "A:\exceldata\excelbook1to10.xls", True, ""

End Sub

-----------------------------------------

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to import data from daily reports (excel) into excel database Import data from excel to excel Excel Discussion (Misc queries) 2 May 30th 06 04:18 PM
Linking workbook and range protected Excel sheet to Access richiverse718 Excel Discussion (Misc queries) 0 March 20th 06 11:51 PM
Import from Access to Excel, via pivot table Ali Excel Discussion (Misc queries) 1 March 14th 06 10:42 PM
Access tables in Excel widman Excel Discussion (Misc queries) 0 March 7th 06 08:26 PM
Excel graphs with Access database beholder Excel Discussion (Misc queries) 2 February 17th 06 06:25 PM


All times are GMT +1. The time now is 09:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"