Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel - VBA - QueryTable error 1004
This code works fine with an Oracle database via ODBC.
But with SQL Server via OLEDB an 1004 error occurs : why ??? ["xxx" replaces private data] Dim qt As Excel.QueryTable Dim strSQL As String Dim strConnexion As String strSQL = "SELECT Id, Libelle FROM Profil" strConnexion = "Provider=sqloledb;Data Source=xxx.xxx.xxx.xxx;Initial Catalog=xxx;User Id=xxx;Password=xxx" Set qt = ActiveSheet.QueryTables.Add(Connection:=strConnexi on, Destination:=ActiveSheet.Range("A1"), Sql:=strSQL) The strConnexion has been generated by an UDL file. Thanks. Jacques. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Prevent error messagebox when refresing querytable from the web fails | New Users to Excel | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
VB6 and Excel - 1004 error | Excel Programming | |||
Error 1004 in Excel 97... | Excel Programming | |||
RunTime Error "1004" QueryTable is Invalid | Excel Programming |