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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| '---------------------------------------------------------------------------------------
' Author : Olivier CATTEAU / Oliv-
' Date : 24/04/2012 16:59
' Purpose : Changement du Niveau de Sécurité dans WORD ET Excel 2003 à 2010 à MOYEN
'---------------------------------------------------------------------------------------
Dim WshShell, bKey, pKey, pKeyW,pKeyConf,pKeyOl, quest
Set WshShell = WScript.CreateObject("WScript.Shell")
on error resume next
pKey = "HKCU\Software\Microsoft\Office\11.0\Excel\Security\Level"
pKeyW = "HKCU\Software\Microsoft\Office\11.0\Word\Security\Level"
pKeyConf = "HKCU\Software\Microsoft\Office\11.0\Excel\Security\accessVBOM"
Err.Clear
pKeyOl= "HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\security"
bKey = WshShell.RegRead(pKey)
'Wscript.Echo pKey & vncr & bKey
'test EXCEL 2003
If (Err = 0) then
'Wscript.Echo Computer & " " & Err.Description
Err.Clear
quest = vbYes 'MsgBox("Activer les Macros ?",vbYesNo + 256 + vbQuestion, "Word et Excel 2003")
if (quest = vbYes) then
WshShell.RegWrite pKey, 2,"REG_DWORD"
WshShell.RegWrite pKeyW, 2,"REG_DWORD"
WshShell.RegWrite pKeyConf, 1,"REG_DWORD"
WshShell.RegWrite pKeyOl, 2,"REG_DWORD"
msgbox "Les Macros sont activées à un niveau Moyen" & vbcr & "vous devrez cliquer sur [Activer les Macros]",0, "Word et Excel 2003"
end if
end if
Err.Clear
'test EXCEL 2007
pKey = "HKCU\Software\Microsoft\Office\12.0\Excel\Security\VBAWarnings"
pKeyW = "HKCU\Software\Microsoft\Office\12.0\Word\Security\VBAWarnings"
pKeyConf = "HKCU\Software\Microsoft\Office\12.0\Excel\Security\accessVBOM"
Err.Clear
pKeyOl= "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\security"
bKey = WshShell.RegRead(pKey)
If (Err = 0) then
'Wscript.Echo Computer & " " & Err.Description
Err.Clear
quest = vbYes 'MsgBox("Activer les Macros ?",vbYesNo + 256 + vbQuestion, "Word et Excel 2007")
if (quest = vbYes) then
WshShell.RegWrite pKey, 2,"REG_DWORD"
WshShell.RegWrite pKeyW, 2,"REG_DWORD"
WshShell.RegWrite pKeyConf, 1,"REG_DWORD"
WshShell.RegWrite pKeyOl, 2,"REG_DWORD"
msgbox "Les Macros sont activées à un niveau Moyen" & vbcr & "vous devrez cliquer dans le cadre 'Avertissement de sécurité'" & vbcr & "sur [Options...] [Activer ce contenu]",0, "Word et Excel 2007"
end if
end if
Wscript.Echo "suit"
'test 2010
pKey = "HKCU\Software\Microsoft\Office\14.0\Excel\Security\VBAWarnings"
pKeyW = "HKCU\Software\Microsoft\Office\14.0\Word\Security\VBAWarnings"
pKeyConf = "HKCU\Software\Microsoft\Office\14.0\Excel\Security\accessVBOM"
Err.Clear
pKeyOl = "HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Security\Level"
bKey = WshShell.RegRead(pKey)
If (Err = 0) Then
'Wscript.Echo Computer & " " & Err.Description
Err.Clear
quest = vbYes ' MsgBox("Activer les Macros ?",vbYesNo + 256 + vbQuestion, "Outlook, Word et Excel 2010")
If (quest = vbYes) Then
WshShell.RegWrite pKey, 2, "REG_DWORD"
WshShell.RegWrite pKeyW, 2, "REG_DWORD"
WshShell.RegWrite pKeyConf, 1, "REG_DWORD"
WshShell.RegWrite pKeyOl, 2, "REG_DWORD"
MsgBox "Les Macros sont activées à un niveau Moyen" & vbCr & "vous devrez cliquer dans le cadre 'Avertissement de sécurité'" & vbCr & "sur [Options...] [Activer ce contenu]", 0, "Word et Excel 2010"
End If
Else: MsgBox Err.Description
End If
WScript.Echo "traitement terminé" |
Partager