Gruppe
Extern
Problem
Excel/VBA-Beispiel: Registry-Einträge schreiben, lesen, löschen
StandardModule: Modul1
Sub RegWrite()
Dim wsh As New IWshShell_Class
With wsh
.RegWrite "HKCU\Software\HWH\", "Dies ist eine Voreinstellung"
.RegWrite "HKCU\Software\HWH\MyString", "Eine Zeichenfolge"
.RegWrite "HKCU\Software\HWH\MyNumString", 12345
.RegWrite "HKCU\Software\HWH\MyDwordValue", 12345, "REG_DWORD"
.RegWrite "HKCU\Software\HWH\MyBinaryValue", 12345, "REG_BINARY"
End With
Set wsh = Nothing
End Sub
Sub RegRead()
Dim wsh As New IWshShell_Class
With wsh
MsgBox .RegRead("HKCU\Software\HWH\") & vbLf & _
.RegRead("HKCU\Software\HWH\MyString") & vbLf & _
.RegRead("HKCU\Software\HWH\MyNumString") & vbLf & _
.RegRead("HKCU\Software\HWH\MyDwordValue")
End With
Set wsh = Nothing
End Sub
Sub RegDelete()
Dim wsh As New IWshShell_Class
wsh.RegDelete "HKCU\Software\HWH\"
' wsh.RegDelete "HKCU\Software\HWH\MyString"
' wsh.RegDelete "HKCU\Software\HWH\MyNumString"
' wsh.RegDelete "HKCU\Software\HWH\MyDwordValue"
' wsh.RegDelete "HKCU\Software\HWH\MyBinaryValue"
' wsh.RegDelete "HKCU\Software\HWH\"
Set wsh = Nothing
End Sub