1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Worksheets("TEST").Activate
ActiveSheet.Cells.Clear
Dim sql As String
sql = "SELECT DISTINCT publi.publication FROM " & _
"(SELECT ctlo.CODE_ISIN FROM PERF.T_CTL_OPCVM ctlo MINUS SELECT o.CODE_ISIN FROM PERF.T_OPCVM o WHERE o.D_DATE = '12/01/2010') T1, " & _
"PERF.T_CTL_OPCVM T2, (select distinct C.ll_codif as publication, P.cd_isin_1 AS code_isin, " & _
"PE.libelle AS nom_europerf from user_ref.t_produit P, user_ref.t_prod_publi PP, user_ref.t_codif C, " & _
"perf.t_opcvm PE where PP.id_publication = C.id_codif and P.id_produit = PP.id_produit and P.cd_isin_1 = PE.code_isin) publi " & _
"WHERE T1.code_isin = T2.code_isin AND T2.code_isin = publi.code_isin"
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=xxx;UID=xxx;PWD=xxx;SERVER=xxx;", Destination:=Sheets("TEST").Range("B1"))
.CommandText = Array( _
sql)
.Name = "Lancer la requête à partir de santorin"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.Refresh BackgroundQuery:=True
End With |