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 16:59] jacobt |
v8_0_0:designer:menus:accueil:nouvellerequete:restitution:excel:exemplemacro [2020/07/07 17:48] (Version actuelle) jacobt |
||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | ====== Exemple de macro ====== | ||
- | Sub VIGILENS_Nom de la requ�te() \\ | + | Exemple de Macro qui permet directement depuis excel de supprimer les données puis de recharger des données réactualisées. |
- | ' \\ | + | |
- | ' Supprimer les donn�es \\ | + | |
- | Call SUPP_VIGILENS_Nom de la requ�te \\ | + | |
- | ' \\ | + | |
- | Dim DATEVIG As Variant \\ | + | |
- | Dim CLIENTVIG As Variant \\ | + | |
- | DATEVIG = "&DATE=" + Worksheets("SHEET1").Range("$C$1").Text | + | __Tout les mots surlignés sont a modifier selon avec les informations de l'utilisateur.__ |
- | CLIENTVIG = "&CLIENT=" + Worksheets("SHEET1").Range("$C$2").Text | + | |
- | + | ||
- | 'MsgBox (DATEVIG) Param�tre � l'excution de la requ�te VIGILENS | + | |
- | 'MsgBox (CLIENTVIG) Param�tre � l'excution de la requ�te VIGILENS | + | |
- | With Worksheets("SHEET DATA").QueryTables.Add(Connection:= _ | + | 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>() \\ |
- | "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")) | + | ' Supprimer les données \\ |
- | .Name = "Nom de la requ�te Vigilens" | + | 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> \\ |
- | .FieldNames = True | + | ' \\ |
- | .RowNumbers = False | + | Dim DATEVIG As Variant \\ |
- | .FillAdjacentFormulas = False | + | Dim CLIENTVIG As Variant |
- | .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 | + | |
+ | 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 VIGILENS \\ | ||
+ | 'MsgBox (CLIENTVIG) Paramètre à l'excution de la requète VIGILENS | ||
+ | |||
+ | 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 | ||
+ | |||
+ | 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>()\\ | ||
+ | '\\ | ||
+ | '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 | ||
- | Sub SUPP_VIGILENS_Nom de la requ�te() \\ | ||
- | ' \\ | ||
- | 'cette Macro supprime les donn�es \\ | ||
- | ' | ||
- | On Error Resume Next | ||
- | With Worksheets("SHEET DATA") | ||
- | .QueryTable.Delete | ||
- | .Columns("A:XX").ClearContents | ||
- | End With | ||
- | End Sub | ||