'Native VBA method to change Excel Macro Setting

supposing this option is already enabled on Excel Trust Center:

Enable all macros (not recommended)

I want to change that setting to:

Disable all except digitally signed macros

I can use the below registry setting and apply by VBA.CreateObject("WScript.Shell")

[HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security]
"VBAWarnings"=dword:00000003

But, I ask about a native VBA method other than Windows registry editing.
Thanks for your help.



Solution 1:[1]

unfortunately, there is no a native VBA method to change Macro Settings.
the available way is by using windows registry key and VBA FileSystemObject (FSO),
Note: you have to add reference to the Microsoft Scripting Runtime Library.

Sub change_Macro_Settings()

  Dim myWS As Object: Set myWS = VBA.CreateObject("WScript.Shell")
   Dim name As String, value As String, stype As String
    name = "HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security\VBAWarnings"
     value = "3"
      stype = "REG_DWORD"
       myWS.RegWrite name, value, stype
  
End Sub

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Leedo