Forum Discussion
Default blocking of macros ???
I got a little bit further with your proposals - THX, BUT ...
The "DisableMacroBlock.reg" would NOT run by double-clicking - I had to manually add the keys.
Too I did the PowerShell-fix !
Still I have a sort of blocking - but of another kind - I was link to https://support.microsoft.com/da-dk/topic/indstillinger-for-dokumenter-der-er-tillid-til-er-blevet-%C3%A6ndret-0be30e4c-926a-4761-bdef-3f91097beb5a:
EDIT: SOME macros ARE running - this one:
Private Sub Workbook_Open()
' ActiveWindow.DisplayGridlines = False
' Application.DisplayFormulaBar = False
' ActiveWindow.DisplayHeadings = False
' Application.CommandBars.ExecuteMso "HideRibbon"
' Application.ExecuteExcel4Macro "show.toolbar(""Ribbon"",FALSE)"
With ThisWorkbook
nextPNR = .Sheets("NR-Ark").Range("A1")
' dette 2 linier opfattes MÅSKE som en andring af filen ????
rejectOpenWord = .Sheets("NR-Ark").Range("A5")
markerObjecter True
MsgBox Environ("IDFrandsen"), , "Der køres på disse data:"
End With
End Sub
and after I click OK button a YELLOW line telling me settings for trusted documents are changed and THEN I have the key that leads me to the site I linked to i my last posting.
- Aug 01, 2025
You can allow Office to trust documents again. Here’s a registry script that reenables Trusted Documents behavior:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Security\Trusted Documents] "DisableTrustedDocuments"=dword:00000000 "AllowTrustedLocationsInNetworkLocations"=dword:00000001
Again, adjust the version number (16.0) if needed.
Then, after opening the file and enabling content once, it should remember the trust and stop showing the yellow banner unless the file changes or the cache resets again.
IF NOT
Instead of trusting each file, make sure the entire folder is trusted.
You can:
- Go to Excel > File > Options > Trust Center > Trust Center Settings > Trusted Locations.
- Add the full local path to your OneDrive folder.
- Check “Subfolders of this location are also trusted.”
⚠️ But keep in mind: shared folders from others in OneDrive don’t always inherit this trust — this only applies to your local synced files.
------------------------------------
Don't forget to mark as solution if my answer suits you- keldsorAug 02, 2025Brass Contributor
I've now investigated a little more !
I still have this stupid YELLOW line on top og the sheet - but it can be closed with the X-button and then the sheet SEEMS to work BUT...
in fact it's the macro referenced in my OnAction for each shape that CAN'T be found ... ALL other macros WILL run.
My Excel sheet has a lot of SHAPES users can click and then the OnAction SHOULD start a macro with some parameters from that shape - but the macro can't be found !
What's so special with these "OnAction" for each of my shapes ?
- keldsorAug 02, 2025Brass Contributor
I think it gets more and more spooky !
In my last replay I said that ONE of my macros DID run - but it's not the whole truth - some of my macros are NOT present when I try to show macros eventhough I can see them if I go to VBA by ALT-F11 !
- keldsorAug 01, 2025Brass Contributor
If I add this key to the registry:
"AllowTrustedLocationsInNetworkLocations"=dword:00000001
and the reboot - it worked ... but the NEXT time I opened the file I have the same YELLOW message line !!!!
You wrote:
"Then, after opening the file and enabling content once, it should remember the trust and stop showing the yellow banner unless the file changes or the cache resets again."
1) it CLEARLY don't REMEMBER the trust and stop showing the yellow banner
2) ofcause the file CHANGES ... that's the whole purpose of users opening the file in the first place
This security-crap is driving me in sane ... and I think it has to be re-engeeniered a lot more for outsiders to understand 😭
EDIT:
I think I have to include the registry I made:
- Aug 04, 2025
I can understand, there is some solutions maybe you can try :
1. Force Trust with a Trusted Location
Instead of relying on Trusted Documents (which are volatile), use only Trusted Locations:- Open Excel → File → Options → Trust Center → Trust Center Settings → Trusted Locations.
- Add the exact full path to the local OneDrive folder (like C:\Users\YourName\OneDrive\MyFolder).
- Enable “Subfolders of this location are also trusted.”
If your file is opened from a shared folder shortcut like OneDrive - Contoso\SharedFolder, it might not be treated as local. Test by copying the file to your own OneDrive folder first.
2. Unblock the file permanently
If there's still a Mark of the Web, PowerShell it:Unblock-File -Path "C:\Users\YourName\OneDrive\MyFolder\YourFile.xlsm"
3. Bundle your macros in an add-in (.xlam)
If your workbook just holds shapes and data, and all your macro logic is in code, consider:- Moving your macros to an .xlam add-in (which is placed in a fully trusted folder).
- Shapes still call .OnAction = "YourMacro", but the macro is guaranteed to load from the add-in.
This bypasses the workbook’s trust issues entirely, while keeping macros stable.
You're totally right: Office macro security is powerful but way too opaque for real-world usability, especially when things half work and give misleading signals (like macros partially loading, but not showing in the list).
------------------------------------
Don't forget to mark as solution if my answer suits you