Hi,

I am having a lot difficulty trying to get an Excel 2007 table import into a SQL Server 2005 table. I have looked through the internet and cannot find any help other than download software. The main problem I have come across is that I want the user to be in the Excel and click a macro button to import the data.

The code I have been trying is:


Dim con As Object

Set con = CreateObject("ADODB.Connection")
con.Open _
"Provider=SQLOLEDB.1;Data Source=ORLA-PC\SQLEXPRESS;" & _
"Initial Catalog=Edpac;Trusted_Connection=Yes"
con.Execute _
"SELECT * FROM OPENROWSET('MICROSOFT.JET.OLEDB.4.0'," & _
"'Text;Database=C:\Users\Orla\AppData\Local\Temp\;','SELECT * FROM [Book1.xls]')"

I did find a web page that told me about permissions so I did everything they told me so every group and user name was allowed full control in the Temp folders.

Any help would be greatly appreciated!
Thanks,
Orla