Reconfiguration fichier MAJ DEV sur Prod
This commit is contained in:
33
Scripts/set_cell_silent.vbs
Normal file
33
Scripts/set_cell_silent.vbs
Normal file
@@ -0,0 +1,33 @@
|
||||
' set_cell_silent.vbs
|
||||
' Usage: cscript //nologo set_cell_silent.vbs "C:\x\file.xlsm" "Feuille" "A1" "Valeur"
|
||||
|
||||
On Error Resume Next
|
||||
|
||||
If WScript.Arguments.Count < 4 Then WScript.Quit 1
|
||||
|
||||
Dim fpath, sname, addr, val
|
||||
fpath = WScript.Arguments(0)
|
||||
sname = WScript.Arguments(1)
|
||||
addr = WScript.Arguments(2)
|
||||
val = WScript.Arguments(3)
|
||||
|
||||
Dim xl, wb, ws
|
||||
Set xl = CreateObject("Excel.Application")
|
||||
xl.DisplayAlerts = False
|
||||
xl.Visible = False
|
||||
xl.AutomationSecurity = 3 ' macros OFF
|
||||
xl.EnableEvents = False ' événements OFF
|
||||
|
||||
Set wb = xl.Workbooks.Open(fpath, 0, False)
|
||||
If Err.Number <> 0 Then xl.Quit: WScript.Quit 2
|
||||
|
||||
Set ws = wb.Worksheets(sname)
|
||||
If Err.Number <> 0 Then wb.Close False: xl.Quit: WScript.Quit 3
|
||||
|
||||
ws.Range(addr).Value = val
|
||||
If Err.Number <> 0 Then wb.Close False: xl.Quit: WScript.Quit 4
|
||||
|
||||
wb.Save
|
||||
wb.Close False
|
||||
xl.Quit
|
||||
WScript.Quit 0
|
||||
Reference in New Issue
Block a user