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
| 'approuve un emplacement pour désactiver l'avis de sécurité - adapté à office 2007 (version=10) et 2010 (version=14)
'ne fonctionne que pour les utilisateurs administrateurs !
'on retrouve l'écriture dans regedit (ou regedt32) : HKEY_CURRENT_USER>SoftWare...
'd'après http://www.developpez.net/forums/d981626/logiciels/microsoft-office/access/runtime/avis-securite-microsoft-access/
Public Sub approuve(version As String)
If Not Mode_debug Then On Error GoTo err:
Dim KEY As String, s As String, loc As String
KEY = "HKCU\Software\Microsoft\Office\" & version & ".0\Access\Security\Trusted Locations\"
s = "..." 'emplacement à approuver
loc = KEY & "Location10\"
if left(s,2)="\\" then WriteIntoReg KEY, "AllowNetworkLocations", 1, "REG_DWORD" '1 = autorise les emplacements réseau
WriteIntoReg loc, "AllowSubFolders", 1, "REG_DWORD" '1 = autorise les sub_folders
WriteIntoReg loc, "Date", Date, "REG_SZ"
WriteIntoReg loc, "Description", "mon p''tit dossier à moi", "REG_SZ"
WriteIntoReg loc, "Path", s, "REG_SZ"
err:
End Sub
Public Function WriteIntoReg(ByVal KEY As String, ByVal Value As String, ByVal Data, ByVal DataType As String) As Boolean
Dim WshShell As Object
On Error GoTo WriteIntoReg_Error
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite KEY & Value, Data, DataType
WriteIntoReg = True
On Error GoTo 0
WriteIntoReg_Exit:
Set WshShell = Nothing
Exit Function
WriteIntoReg_Error:
WriteIntoReg = False
Resume WriteIntoReg_Exit
End Function |
Partager