![]() |
QueryTables.Add Connection Parameter
I am trying to connect to an existing Excel 97 spreadsheet.
I have found the following connection strings from www.connectionstrings.com/. I have tried both versions (seperately) and I get the same error message 1004: application-defined or object-defined error. I have been able to use this method to connect to an external Oracle database using ODBC. Is there something wrong with my coonection string? BTW ThisSheet is declared as Excel.Worksheet and definitely exists. ThisSheet.QueryTables.add Connection:="Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=D:\MonthlyStatsMaster.xl s;DefaultDir=D:\;", _ ' Destination:=ThisSheet.Range("A1"), Sql:="Select * from [Hierarchy$]" ThisSheet.QueryTables.add Connection:="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\MonthlyStatsMaster.xls;Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1""", _ Destination:=ThisSheet.Range("A1"), Sql:="Select * from [Hierarchy$]" Nirmal Singh |
All times are GMT +1. The time now is 05:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com