Microsoft ApplicationsMicrosoft Legacy OSMicrosoft Server Apps
Last Comment
VIJAY2766
8/22/2022 - Mon
MarkieS
These two functions enable you to read and write to the Registry
Function WriteReg(RegPath, Value, RegType)
'Regtype should be “REG_SZ” for string, “REG_DWORD” for a integer,…
'”REG_BINARY” for a binary or boolean, and “REG_EXPAND_SZ” for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegWrite(RegPath, Value, RegType)
WriteReg = Key
End Function
Function ReadReg(RegPath)
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)
ReadReg = Key
End Function
IS THIS CORRECT
*************************************************************************************8
Function WriteReg(RegPath, Value, RegType)
'Regtype should be “REG_SZ” for string, “REG_DWORD” for a integer,…
'”REG_BINARY” for a binary or boolean, and “REG_EXPAND_SZ” for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Temp = WriteReg("HKLM\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources\Time","SQL Native Client","REG_SZ")
Temp = WriteReg("HKLM\SOFTWARE\ODBC\ODBC.INI\OnBase\Driver","C:\WINDOWS\system32\sqlncli.dll","REG_SZ")
Temp = WriteReg("HKLM\SOFTWARE\ODBC\ODBC.INI\OnBase\Description","Time","REG_SZ")
Temp = WriteReg("HKLM\SOFTWARE\ODBC\ODBC.INI\OnBase\Server","s016\\CM","REG_SZ")
Temp = WriteReg("HKLM\SOFTWARE\ODBC\ODBC.INI\OnBase\Database","Time","REG_SZ")
Temp = WriteReg("HKLM\SOFTWARE\ODBC\ODBC.INI\OnBase\LastUser","hsi","REG_SZ")
Key = objRegistry.RegWrite(RegPath, Value, RegType)
WriteReg = Key
End Function
Function WriteReg(RegPath, Value, RegType)
'Regtype should be “REG_SZ” for string, “REG_DWORD” for a integer,…
'”REG_BINARY” for a binary or boolean, and “REG_EXPAND_SZ” for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegWrite(RegPath, Value, RegType)
WriteReg = Key
End Function
Function ReadReg(RegPath)
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)
ReadReg = Key
End Function
Function WriteReg(RegPath, Value, RegType)
'Regtype should be “REG_SZ” for string, “REG_DWORD” for a integer,…
'”REG_BINARY” for a binary or boolean, and “REG_EXPAND_SZ” for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegWrite(RegPath, Value, RegType)
WriteReg = Key
End Function
Function ReadReg(RegPath)
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)
ReadReg = Key
End
MarkieS
And that's the trouble when you keep getting interupted by your work colleagues!!!
Try a copy and paste of everything below the line - It was missing the End Function
Function WriteReg(RegPath, Value, RegType)
'Regtype should be “REG_SZ” for string, “REG_DWORD” for a integer,…
'”REG_BINARY” for a binary or boolean, and “REG_EXPAND_SZ” for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegWrite(RegPath, Value, RegType)
WriteReg = Key
End Function
Function ReadReg(RegPath)
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shell")
Key = objRegistry.RegRead(RegPath)
ReadReg = Key
End Function
VIJAY2766
ASKER
I am still getting error
Invalid Character Line1 Char 1
Function WriteReg(RegPath, Value, RegType)
'Regtype should be “REG_SZ” for string, “REG_DWORD” for a integer,…
'”REG_BINARY” for a binary or boolean, and “REG_EXPAND_SZ” for an expandable string
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shel
Key = objRegistry.RegWrite(RegPa
WriteReg = Key
End Function
Function ReadReg(RegPath)
Dim objRegistry, Key
Set objRegistry = CreateObject("Wscript.shel
Key = objRegistry.RegRead(RegPat
ReadReg = Key
End Function