Sub AddPathToTrustedLocations()
  Const strMsg = "Do you want to add the path of this workbook " & _
    "to your Trusted Locations?"
  Const strReg = "HKEY_CURRENT_USER\Software\Microsoft\Office\" & _
    "12.0\Excel\Security\Trusted Locations\ABabeNChrist\"
  Dim objShell As Object
  Dim strValue As String
  Dim strPath As String
  Set objShell = CreateObject("WScript.Shell")
  strPath = ActiveWorkbook.Path
  On Error Resume Next
  strValue = objShell.RegRead(strReg & "Path")
  On Error GoTo 0
  'If strValue <> strPath Then
    'If MsgBox(strMsg, vbQuestion + vbYesNo) = vbYes Then
      objShell.RegWrite strReg & "Path", strPath, "REG_SZ"
    'End If
  'End If
  Set objShell = Nothing
End Sub




 

0 komentar:
Posting Komentar