Dim strSQLa1 As String strSQLa1 = "" strSQLa1 = strSQLa1 & ""... With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _ "OLEDB;Provider=MSDASQL.1;Persist Security Info=True;Extended Properties=""DSN=pr****es;Description=PR****ES;UID=Administrateur;APP=Micr" _ , "osoft Office 2003;WSID=GFPCORDIRPO01;DATABASE=PR****ES"""), Destination:= _ Range("$C$1")).QueryTable .CommandType = xlCmdSql .CommandText = strSQLa1 .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .ListObject.DisplayName = _ "Tableau_SQL_Queries___PR****ES__192.168.*.*____9.16.2.x1" .Refresh BackgroundQuery:=False End With
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim strSQLp1 As String strSQLp1 = " strSQLp1 = strSQLp1 & ""... With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _ "OLEDB;Provider=MSDASQL.1;Persist Security Info=True;Extended Properties=""DSN=pr****es;Description=PR****ES;UID=Administrateur;APP=Micr" _ , "osoft Office 2003;WSID=GFPCORDIRPO01;DATABASE=PR****ES"""), Destination:= _ Range("$C$1")).QueryTable .CommandType = xlCmdSql .CommandText = strSQLp1 .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .ListObject.DisplayName = _ "Tableau_SQL_Queries___PR****ES__192.168.*.*____9.16.2.x1" .Refresh BackgroundQuery:=False End With
Dim oDataObject As DataObject Set oDataObject = New DataObject oDataObject.SetText "" oDataObject.PutInClipboard Set oDataObject = Nothing
Application.CutCopyMode = False
Dim strSQLr1 As String Dim RConnect As String strSQLr1 = "" strSQLr1 = strSQLr1 & ""... RConnect = "OLEDB;Provider=MSDASQL.1;Persist Security Info=True;Extended Properties=""DSN=pr***one;Description=PR***ONE;UID=Administrateur;DATABASE=PR***ONE""" Range("C1").CurrentRegion.ClearContents With ActiveSheet.QueryTables.Add(Connection:=RConnect, Destination:=ActiveSheet.Range("C1")) .CommandText = strSQLr1 .Name = "Tableau_SQL_Queries_PR***ONE_192.168.*.*_9.16.2.x1" .Refresh BackgroundQuery:=False End With
.Refresh BackgroundQuery:=False
Dim strSQLa1 As String strSQLa1 = "" strSQLa1 = strSQLa1 & ""... With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _ "OLEDB;Provider=MSDASQL.1;Persist Security Info=True;Extended Properties=""DSN=pr****es;Description=PR****ES;UID=Administrateur;APP=Micr" _ , "osoft Office 2003;WSID=;DATABASE=PR****ES"""), Destination:= _ Range("$C$1")).QueryTable .CommandType = xlCmdSql .CommandText = strSQLa1 .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 0 .PreserveColumnInfo = True .ListObject.DisplayName = _ "Tableau_SQL_Queries___PR****ES__192.168.*.*____9.16.2.x1" .Refresh BackgroundQuery:=False End With