|
-
Aug 30th, 2012, 09:26 AM
#1
Thread Starter
New Member
altering the registry
Hi,
I'm a java developer, but as of yesterday, it's expected of me to maintain and fix a massive VB prog. Anyway, I've been trying to run scripts to alter the registry. The code completes without error but the registries don't change. i found two paradigms to follow, but the result is the same in both cases. I'm using Access 2010 and VS 9.0.
Here is the method:
Code:
Private Function AllowWriting() As Boolean
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
Dim oExec As Object
AllowWriting = False
If Me.TestDBBox.value = True Then
MsgBox "Proceeding with test database."
'EXECUTE ONE OR THE OTHER. IN EITHER CASE, REG DOESN'T CHANGE
' WshShell.Run "regedit /S C:\ListWizard\RatsDBRegistryEntries\RWWprod.reg", 1, True
' Set oExec = WshShell.Exec("regedit /S C:\ListWizard\RatsDBRegistryEntries\RWWdev.reg")
AllowWriting = True
ElseIf Me.TestDBBox.value = False Then
MsgBox "Proceeding with live database. Exercise judgement and discretion."
' WshShell.Run "regedit /S C:\ListWizard\RatsDBRegistryEntries\RWWprod.reg", 1, True
' Set oExec = WshShell.Exec("regedit /S C:\ListWizard\RatsDBRegistryEntries\RWWprod.reg")
AllowWriting = True
End If
End Function
Also, i tried numerous versions of this method:
Shell("C:\ListWizard\RatsDBRegistryEntries\RWWdev.reg", 1)
no matter what i put in the parameters, it throws a runtime error. But I think this Shell() is for .exe, so .reg will always fail, right?
Thank you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|