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
| Sub TestPourVoir()
'REG_SZ
'REG_DWORD
'REG_BINARY
'REG_EXPAND_SZ
Const KEY As String = "HKCU\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations\Location0\"
Const VALUE1 As String = "AllowSubFolders"
Const VALUE2 As String = "Date"
Const VALUE3 As String = "Description"
Const VALUE4 As String = "Path"
Dim blnAllowSubFolder As Boolean
Dim strDate As String
Dim strDescription As String
Dim strPath As String
strDate = Now
strDescription = "Mon chemin de test pour le déploiement"
strPath = "C:\Documents and Settings\ambrosinojp\My Documents\MDBTests"
WriteIntoReg KEY, VALUE1, 0, "REG_DWORD"
WriteIntoReg KEY, VALUE2, strDate, "REG_SZ"
WriteIntoReg KEY, VALUE3, strDescription, "REG_SZ"
WriteIntoReg KEY, VALUE4, strPath, "REG_SZ"
Call Shell(Environ("WINDIR") & "\System32\regedt32.exe", 3)
End Sub
Private 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