meta données pour cette page
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
v8_0_0:designer:menus:accueil:nouvellerequete:restitution:excel:exemplemacro [2020/07/07 17:00] jacobt |
v8_0_0:designer:menus:accueil:nouvellerequete:restitution:excel:exemplemacro [2020/07/07 17:48] (Version actuelle) jacobt |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | <code> | + | ====== Exemple de macro ====== |
- | Sub VIGILENS_<font inherit/inherit;;inherit;;#f39c12>Nom de la requète()</font> \\ | + | |
- | ' \\ | + | |
- | ' Supprimer les données \\ | + | |
- | Call SUPP_VIGILENS_Nom de la requète \\ | + | |
- | ' \\ | + | |
- | Dim DATEVIG As Variant \\ | + | |
- | Dim CLIENTVIG As Variant \\ | + | |
- | </code> | + | Exemple de Macro qui permet directement depuis excel de supprimer les données puis de recharger des données réactualisées. |
- | <code> | + | __Tout les mots surlignés sont a modifier selon avec les informations de l'utilisateur.__ |
- | DATEVIG = "&DATE=" + Worksheets("SHEET1").Range("$C$1").Text | + | |
- | CLIENTVIG = "&CLIENT=" + Worksheets("SHEET1").Range("$C$2").Text | + | |
- | 'MsgBox (DATEVIG) Paramètre à l'excution de la requète VIGILENS | + | Sub VIGILENS_<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>() \\ |
- | 'MsgBox (CLIENTVIG) Paramètre à l'excution de la requète VIGILENS | + | ' \\ |
+ | ' Supprimer les données \\ | ||
+ | Call SUPP_VIGILENS_<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 | ||
- | </code> | + | 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 \\ | ||
- | <code> | + | 'MsgBox (DATEVIG) Paramètre à l'excution de la requète VIGILENS \\ |
- | With Worksheets("SHEET DATA").QueryTables.Add(Connection:= _ | + | 'MsgBox (CLIENTVIG) Paramètre à l'excution de la requète VIGILENS |
- | "URL;http://Nom du serveur/vigilens/table.php?vglOutput=XLTable&vglCtrlName=chemin\Nom de la requète&vglUserName=Nom de l'utilisteur VIGILENS" + DATEVIG + CLIENTVIG _ | + | |
- | , Destination:=Sheets("SHEET DATA").Range("$A$1")) | + | |
- | .Name = "Nom de la requète Vigilens" | + | |
- | .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 | + | |
- | </code> | + | 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'utilisteurVIGILENS</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>Vigilens</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 | ||
- | <code> | + | Sub SUPP_VIGILENS_<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>()\\ |
- | Sub SUPP_VIGILENS_Nom de la requète() \\ | + | '\\ |
- | ' \\ | + | 'cette Macro supprime les données\\ |
- | 'cette Macro supprime les données \\ | + | ' \\ |
- | ' | + | On Error Resume Next \\ |
- | On Error Resume Next | + | With Worksheets("<font inherit/inherit;;#ffffff;;#16a085>SHEET DATA</font>") \\ |
- | With Worksheets("SHEET DATA") | + | .QueryTable.Delete \\ |
- | .QueryTable.Delete | + | .Columns("A:XX").ClearContents \\ |
- | .Columns("A:XX").ClearContents | + | End With \\ |
- | End With | + | End Sub |
- | End Sub | + | |
- | + | ||
- | </code> | + | |