Jump to content

azizrasul

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by azizrasul

  1. azizrasul

    Functions

    In the following code I want to check whether a registry key exists before deleting the key. I have a function that checks whether a key exists. See below. I can't get the key to delete, in other words MsgBox "123" never happens. Dim strKey12 strKey12 = "HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Access\Security\Trusted Locations\Location3\" If ReadRegistry(strKey12)=True Then MsgBox "123" Set objShell = CreateObject("WScript.Shell") objShell.RegDelete (strKey12) Set objShell = Nothing End If Public Function ReadRegistry(strKey) Dim strValue Set objShell = CreateObject("WScript.Shell") strValue = objShell.RegRead(strKey) MsgBox strValue If strValue = "" then ReadRegistry = False MsgBox "False" Else ReadRegistry = True MsgBox "True" end if End Function
  2. azizrasul

    Functions

    Does anyone have an example where you can include functions in the same vbscript file and call them? I'm thinking of checking whether a reg key exists before deleting it.
×
×
  • Create New...