top of page
  • John

Unblock a file containing VBA code

Since mid 2022, files containing VBA code (Excel workbooks, Word documents, PowerPoint presentations and also AddIns and Templates) received over the internet or via email can be 'blocked' - preventing the VBA code from running. This is also known as the 'Mark of the web' (or MOTW).


This can result in:

  • Warnings such as the "Microsoft has blocked macros from running because the source of this file is untrusted" banner under the 'ribbon' when opening a workbook, document or presentation (see image below), or

  • Dialogs saying "A potentially dangerous macro has been blocked", or

  • VBA code not running (and so appearing to 'just not work') for AddIns and Templates.

Microsoft has blocked macros from running because the source of this file is untrusted

Unblocking a file is simple process ... note that the screenshots below show the 'unblocking' process on a macro-enable Excel workbook, but the process is the same for all types of files (including .zip files ... if you received one or multiple files all in one .zip archive then you are better to 'unblock' the .zip file as, then, all of the contained files are 'unblocked' in one go).


So once you have saved the file to your device, file share, SharePoint, OneDrive etc then, in File Explorer, right-click the file then select Properties, General … and in the ‘Attributes’ section you will see text similar to ‘This file came from another computer and might be blocked to help protect this computer’ ... check (tick) ‘Unblock’ and select Apply then OK (see screenshots below).


Unblock a file ... before (file is blocked)
Unblock a file ... before (file is blocked)
Unblock a file ... after (file is unblocked)
Unblock a file ... after (file is unblocked)

The file is now unblocked and the VBA code can run.


To read more about this, see the Microsoft announcement that Macros from the internet will be blocked by default in Office.

0 comments

Recent Posts

See All

Kommentare


bottom of page