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 32 33
|
Sub Partage()
'
' Partage Macro
'
'
ActiveWorkbook.Queries.Add Name:="STOCK_A", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Excel.Workbook(File.Contents(""\\dsb-tchnovts\7 - Espace Individuel\Brot\VBA\3 - Recherche_Bibliothèque\Recherche_Bibliothèque_V1.23.xlsm""), null, true)," & Chr(13) & "" & Chr(10) & " STOCK_A_Sheet = Source{[Item=""STOCK_A"",Kind=""Sheet""]}[Data]," & Chr(13) & "" & Chr(10) & " #""En-têtes promus"" = Table.PromoteHeaders(STOCK_A_Sheet, [PromoteAllScalars=true])," & Chr(13) & "" & Chr(10) & " #""Type modifié"" = Table.Tra" & _
"nsformColumnTypes(#""En-têtes promus"",{{""Noms"", type text}, {""Date de modification"", type datetime}, {""Lien vers fichier"", type text}, {""Lien vers dossier"", type text}, {""QTE#(lf)EN STOCK"", type any}, {""#(lf)Auteur #(lf)dernière sortie / entrée#(lf)"", type any}, {""Projet"", type any}, {""Qte#(lf) Avant modification"", type any}, {""Commentaire(s)"", ty" & _
"pe any}})" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Type modifié"""
Sheets.Add After:=ActiveSheet
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=STOCK_A;Extended Properties=""""" _
, Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdSql
.CommandText = Array("SELECT * FROM [STOCK_A]")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "STOCK_A"
.Refresh BackgroundQuery:=False
End With
Selection.ListObject.QueryTable.Refresh BackgroundQuery:=False
End Sub |
Partager