Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using If...Then...Else...EndIf

Status
Not open for further replies.

asulzizra

Programmer
Oct 4, 2020
2
0
0
GB
I have the following code

Code:
Set objShell = CreateObject("WScript.Shell")

strKey = "HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\Licence Key Generator\"
    
RegistryKey1 = objShell.RegRead(strKey & "Path")

MsgBox strKey & "Path: " & vbCrlf & vbCrlf & UCase(RegistryKey1)

Instead of having a message box, how do I amend the code so that I use If...Then...Else...EndIf to see whether the value exists so that if it exists then return True and if not False. I want to use the above code to delete a registry key but want to check if the registry key exists first, before deleting. Hope that makes sense.
 
Are you checking for a specific value, or just whether the registry key exists at all?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top