Exemple de macro
Exemple de Macro qui permet directement depuis excel de supprimer les données puis de recharger des données réactualisées.
Tout les mots surlignés sont a modifier selon avec les informations de l’utilisateur.
Sub ARVA Reporting_<font inherit/inherit;;inherit;;#f1c40f>Nom</font><font inherit/inherit;;inherit;;#f1c40f>de</font><font inherit/inherit;;inherit;;#f1c40f>la</font><font inherit/inherit;;inherit;;#f1c40f>requète</font>()
‘
‘ Supprimer les données
Call SUPP_ARVA Reporting_<font inherit/inherit;;inherit;;#f1c40f>Nom</font><font inherit/inherit;;inherit;;#f1c40f>de</font><font inherit/inherit;;inherit;;#f1c40f>la</font><font inherit/inherit;;inherit;;#f1c40f>requète</font>
‘
Dim DATEVIG As Variant
Dim CLIENTVIG As Variant
DATEVIG = “&DATE=” + Worksheets(“<font inherit/inherit;;#ffffff;;#e74c3c>SHEET1</font>”).Range(“$C$1”).Text
CLIENTVIG = “&CLIENT=” + Worksheets(“<font inherit/inherit;;#ffffff;;#e74c3c>SHEET1</font>”).Range(“$C$2”).Text
‘MsgBox (DATEVIG) Paramètre à l’excution de la requète ARVA Reporting
Reporting’MsgBox (CLIENTVIG) Paramètre à l’excution de la requète ARVA Reporting
With Worksheets(“<font inherit/inherit;;#ffffff;;#16a085>SHEET DATA</font>”).QueryTables.Add(Connection:= _
“URL;http://N<font inherit/inherit;;#ffffff;;#3498db>om du serveur</font>/vigilens/table.php?vglOutput=XLTable&vglCtrlName=<font inherit/inherit;;inherit;;#f1c40f>chemin</font><font inherit/inherit;;inherit;;#f1c40f>\</font><font inherit/inherit;;inherit;;#f1c40f>Nom</font><font inherit/inherit;;inherit;;#f1c40f>de</font><font inherit/inherit;;inherit;;#f1c40f>la</font><font inherit/inherit;;inherit;;#f1c40f>requète</font>&vglUserName=<font inherit/inherit;;#ffffff;;#3498db>Nomdel’utilisteurARVAReporting</font>” + DATEVIG + CLIENTVIG _
, Destination:=Sheets(“<font inherit/inherit;;#ffffff;;#16a085>SHEET DATA</font>”).Range(“$A$1”)) .Name = “<font inherit/inherit;;inherit;;#f1c40f>Nom</font><font inherit/inherit;;inherit;;#f1c40f>de</font><font inherit/inherit;;inherit;;#f1c40f>la</font><font inherit/inherit;;inherit;;#f1c40f>requète</font><font inherit/inherit;;inherit;;#f1c40f>ARVAReporting</font>”
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
Sub SUPP_ARVAReporting_<font inherit/inherit;;inherit;;#f1c40f>Nom</font><font inherit/inherit;;inherit;;#f1c40f>de</font><font inherit/inherit;;inherit;;#f1c40f>la</font><font inherit/inherit;;inherit;;#f1c40f>requète</font>()
‘
‘cette Macro supprime les données
‘
On Error Resume Next
With Worksheets(“<font inherit/inherit;;#ffffff;;#16a085>SHEET DATA</font>”)
.QueryTable.Delete
.Columns(“A:XX”).ClearContents
End With
End Sub
Cliquer sur l’icone pour télécharger le fichier