Excel Import Into Access
I first tried to Import my excel spreadsheet into access with a Windows Script (mainteance script) but a couple cells in some of the columns contain letters and numbers when all the rest of the cells contain numbers only. This confuses the heck out of TransferSpreadsheet and it doesn't work very well.
set oAcc = CreateObject("Access.Application")
oAcc.Visible = True
oAcc.OpenCurrentDatabase "C:\Shipping Database\ShippingDatabase.mdb"
oAcc.DoCMD.TransferSpreadsheet 0,8,"Import","C:\Inetpub\wwwroot\Copy of SHIPPING.xls", True, "'2003'!"
oAcc.UserControl = True
Then I tried ADO.
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "CopyShipShare"
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.ActiveConnection = objConn
objRS.CursorType = 3 'Static cursor.
objRS.LockType = 2 'Pessimistic Lock.
objRS.Source = "Select * from myRange1"
objRS.Open
This works to put everything in recordset so I can work with it. The problem is the Name Range. Is there anyway to tell ADO to Select the whole sheet without opening excel and naming the range of all the cells in the sheet so I can access them? This is a script that needs to run on it's own so I can't open excel every time right before it runs and tell it the range of cell I need. I'm willing to do this in whatever way works if that is WSH or ASP/ADO or automatic export to CSV and then to access. Whatever will do the job. I don't have visual studio so I can't do it with and Application. Thanks for and suggestions.