I developed a Access application using VBA. Everytime I open Access up, I get the following:
I have to click Options -> Enable Content to run my macros. This application will be shared among a couple of people at work who are not so tech savvy. So as per requirements, I must remove it. I've tried signing/packaging the database, but it still does not get rid of the warning.
Type Security, and then press Enter to name the key. On the Edit menu, point to New, and then click DWORD Value. Type DisableHyperlinkWarning, and then press Enter to name the entry. In the right pane, right-click DisableHyperlinkWarning, and then click Modify.
For an individual file, such as a file downloaded from an internet location or an email attachment the user has saved to their local device, the simplest way to unblock macros is to remove Mark of the Web. To remove, right-click on the file, choose Properties, and then select the Unblock checkbox on the General tab.
To do that you have to add the location from where the Excel is launched in the "Trusted Locations".
To do this, do as follows:
This would have to be done on a per-pc basis.
In addition, there is no way to do this from an Excel file point of view as this would completely anihiliate the security feature of letting the user chose to run VBA code or not.
Also a little sidenote, if you sign your Excel file, you'd still need the recipient to trust you as a publisher, so that's why your solution probably did not work.
Edit:
Taking into comments, there does seem to be a way to do it programmatically. As taken from XpertsExchange,
Why not just set the registry entry from code, without invoking Shell? Use the cRegistry class found here:
http://www.vbaccelerator.com/home/VB/Code/Libraries/Registry_and_Ini_Files/Complete_Registry_Control/article.asp
VBA Code:
Dim c As New cRegistry
With c
.ClassKey = HKEY_CURRENT_USER
.SectionKey = "Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\YourTrustedLocationName"
.ValueKey = "Path"
.ValueType = REG_DWORD
.Value = "Full path to Trusted Folder"
End With
The only caveat is that YourTrustedLocationname must be unique ...
You'd have to try if it should be .ValueType = REG_DWORD or REG_SZ. I'm not sure on that one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With