Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import Excel data to access using VB Script
#1
Not Solved
I need to Export an excel sheet to an access table. I get one new excel sheet every month. I could able to do this with the below script.

Option Explicit

Code:
Dim objADOXDatabase,objExcelConn,objAccessConn,objAccessRS,objExcelRS,strSQL
Set objADOXDatabase = CreateObject("ADOX.Catalog")

'Create the database file
objADOXDatabase.Create "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=w:\customer.mdb"

Set objADOXDatabase=Nothing

Set objExcelConn = CreateObject("ADODB.Connection")
Set objAccessConn = CreateObject("ADODB.Connection")

objAccessConn.open  "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=W:\customer.mdb"
'objExcelConn.Open objAccessConn
  
objExcelConn.Provider = "Microsoft.Jet.OLEDB.4.0"
objExcelConn.Properties("Extended Properties").Value = "Excel 8.0"
objExcelConn.Open "W:\test.xls"
  
set objAccessRS = Createobject("ADODB.Recordset")
Set objExcelRS = CreateObject("ADODB.Recordset")

strSQL = "SELECT * INTO [Scenario] FROM [Excel 8.0;DATABASE=W:\test.xls;HDR=No;IMEX=1].[sheet1$];"
objAccessConn.Execute strSQL


But when i am executing this script i am getting an error in the last line "Record is too large". My excel sheet is containing around 255 columns and 2100 rows.

Can anyone tell me how to resolve this error and successfully import excel sheet to access table?

Any help is appreciated!

Thanks
Sheela
Reply


Messages In This Thread
Import Excel data to access using VB Script - by skancha - 10-08-2009, 03:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to Access MS Excel Controls using QTP gayuamlu 0 2,197 06-13-2015, 02:06 AM
Last Post: gayuamlu
  Search and import data from excel under some rules. nwpulele 2 2,970 02-19-2015, 04:10 AM
Last Post: supputuri
  Excel and Driver Script shipu 1 3,861 02-27-2014, 09:09 AM
Last Post: supputuri
Question QTP Script for enter data to DB geethu105 2 3,337 02-24-2014, 06:54 PM
Last Post: guin.anirban
  How to populate data in weblist using excel vijifun 1 3,350 12-05-2013, 12:06 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)