, : " ".
, , , :
"Office . , ".
VBA ( ), , Daniel Pineault DevHut.net 2010 :
DevHut: VBScript
, Excel:
Public   Sub; TrustThisFolder ( __   ; String, _
  ; TrustSubfolders   ; = , _
  ; TrustNetworkFolders   ; = , _
& NBSP; sDescription   ; )
'  , ' Trusted VBA
" Excel " Office
" . & NBSP; . "
' Ths :
' ' Trusted '
" ,   ; & NBSP;   ; False
' Nigel Heffernan   , 2015
'
" Based Daniel Pineault DevHut.net 23, 2010:" www.devhut.net\2010\06\23\VBScript-createset- -VBScript\
' **** **** **** **** CODE IS PUBLIC DOMAIN ** ** ****   ****; ****
'   ; :
'
' 1:  , ' Debug.Print sSubKey & vbTab & SPATH
" 2:   Open, Immediate Window   ; & NBSP; :" TrustThisFolder "Z: \", , , " "
" 3: "Z: \"  , ,
" 4: 2 3:  ,  ,
" 5: & NBSP; ,  ,
Error GoTo ErrSub
sKeyPath   ;
oRegistry   ;
Dim sSubKey As
Dim oSubKeys ' . & NBSP; , & NBSP;
oSubKey '   ;.
bSubFolders   ;
bNetworkLocation As Boolean
iTrustNetwork   ;
SPATH   ;
Dim SDATE As
Dim sDesc As
  ;
HKEY_CURRENT_USER = & H80000001
bSubFolders =
bNetworkLocation = False
__ = ""
  __; = FSO.GetSpecialFolder(2).Path
sDescription = ""
sDescription = " "
  End;
End
(__, 1) < > "\"
  __; = __ & "\"
End
sKeyPath = " "sKeyPath = sKeyPath &" SOFTWARE\Microsoft\Office \"
sKeyPath = sKeyPath & Application.Version
sKeyPath = sKeyPath & "\ Excel\Security\ Locations \"
oRegistry = GetObject ( "winmgmts:\\ \ : StdRegProv." )
" :  , \\cimv2 WMI : StdRegProv
oRegistry.EnumKey HKEY_CURRENT_USER, sKeyPath, oSubKeys
  ; oSubKey   In; oSubKeys
  sSubKey; = CStr (oSubKey)
oRegistry.GetStringValue HKEY_CURRENT_USER, sKeyPath & "\" & sSubKey, "", SPATH
'Debug.Print sSubKey & vbTab & SPATH
SPATH = __
  End;
oSubKey
SPATH < > __
IsNumeric (Replace (sSubKey, "", ""))
= CLng ( (sSubKey, "", "")) + 1
  ; = UBOUND (oSubKeys) + 1
  End;
  sSubKey; = "" & CStr ()
TrustNetworkFolders
  iTrustNetwork; = 1
  oRegistry.GetDWORDValue; HKEY_CURRENT_USER, sKeyPath, "AllowNetworkLocations", iTrustNetwork
iTrustNetwork = 0
oRegistry.SetDWORDValue HKEY_CURRENT_USER, sKeyPath, "AllowNetworkLocations", 1
  End;
  End;
  oRegistry.CreateKey; HKEY_CURRENT_USER, sKeyPath & "\" & sSubKey
oRegistry.SetStringValue HKEY_CURRENT_USER, sKeyPath & "\" & sSubKey, "", __
oRegistry.SetStringValue HKEY_CURRENT_USER, sKeyPath & "\" & sSubKey, "", sDescription
oRegistry.SetDWORDValue HKEY_CURRENT_USER, sKeyPath & "\" & sSubKey, "AllowSubFolders", 1
End
ExitSub:
& nbsp Set; oRegistry = Nothing Sub Output
ErrSub: & nbsp Summary; ExitSub
End sub
Please make a confirmation in the code if you reuse it: this will distinguish you (and StackOverflow) from other messages and other sites where experts (and others) share knowledge without confirmation.