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
| Option Explicit
Private chemin As String
Public Sub Directory()
Dim vchemin As String
vchemin = ThisWorkbook.Path
ChDir vchemin
End Sub
Sub ImportQueryRetUSDTerms()
Dim vResultQuery As QueryTable
Dim vQuerySQL As String
Dim vConnexion
Directory
vQuerySQL = "Select DepositsInterest.Currency, Term_Duration_Groups.Group," _
& "sum(DepositsInterest.AmountEOP),sum(DepositsInterest.AmountAverage),sum(DepositsInterest.Interest)" _
& "From DepositsInterest, Term_Duration_Groups" _
& "Where DepositsInterest.Currency like 'USD'" _
& "AND DepositsInterest.AmountEOP <10000" _
& "AND DepositsInterest.AmountAverage <10000" _
& "AND DepositsInterest.Interest >=0" _
& "AND DepositsInterest.TypeCli like '37' or '41'"
vConnexion = "OLEDB;Provider=Microsoft.Jet.OLEDB.4.0" _
& "Data Source=Cost_of_fund.mdb"
With ActiveWorkbook.Sheets("Terms-QueryResults").QueryTables. _
Add(Connection:=vConnexion, Destination:=Range("A4"), Sql:=vQuerySQL)
.Refresh
End With
End Sub |
Partager