Word Blocked Macros

Copper Contributor

Hi
We created some macros to fill in a Word document according to information provided by a third party software called Protheus. The macros were working perfectly, but as of last week, after some Windows/Office update, the macros were blocked by the system and we couldn't use them anymore.
All macros are saved locally on the pc of the person using it.
We already went to the properties of the files and unlocked.
In the Word Trust Center options, we added the macro paths as trusted, including subfolders.
We set it to run all macros.
We have disabled the protection mode for executing files from the internet.
Even with all these settings, it still gives error.

Error Message: Microsoft Office has identified a potential security issue. Microsoft has blocked macros from running because the source of this file is not trusted.
File Path: C:\Users\(my user)\AppData\Local\Microsoft\Windows\INetCache\Content.Word\~WRC0001.tmp
Microsoft has blocked macros from running because the source of this file is not trusted.

The error message path is one of the only ones we couldn't put as trusted, Word doesn't allow to add it as trusted.

Macros are saved in two folders: C:\sc and C:\contrato

19 Replies

Hola @guifernandes1607 no replies sofar. That's worrying.

 

Same problem here, except we use a Microsoft Access application instead of Protheus. It was all working without problems for at least 3 years until the 1st of September 2022. Our invoices are generated from Access using a Word template on a local PC and a Word macro on the same local PC. No Internet, no Intranet, no network shares.

The PC has “Microsoft Office Professional Plus 2021” installed. I read that Microsoft would prevent execution of macros originating from the Internet in this version as from September 2022.

Nevertheless our local macro (embedded in Normal.dotm) was blocked with the same error messageyou got :

“Microsoft Office has identified a potential security issue. Microsoft has blocked macros from running because the source of this file is not trusted. File Path:

C:\Users\(username)\AppData\Local\Microsoft\Windows\INetCache\Content.Word\~WRC????.tmp”

We tried everything you tried:

-add template folder to trusted locations

-add destination folder to trusted locations

-add C:\Users\......\INetCache\Content.Word” to trusted locations (not allowed)

-enable all macros (not recommended).

To no avail. 

Apparently their latest update wasn’t tested very well. ;-((.

Please let me know, when you find a sulution. 

 

I'm in the same situation, our customers started having the same issue during the month of August. I read that the block had been activated at the end of July. The strange thing is that the first document they open (Word doc with macros) opens flawlessly but the second and following ones get the dialog box about the macros being disabled (with the only option to disable them). The path and file name structure of the non-trusted component is exactly the one you are talking about. This is drving us nuts...
What Version and Build of Office are you using. Here, there is no problem in macro enabled templates saved in the Word Startup folde, the Templates folder, or in another folder that was added as a Trusted Location and into which I regularly save macro enabled templates that one of my clients sends to be for modifications after right clicking on those templates and then on Properties and checking the Unblock box. That is with a 64-bit installation of Microsoft 365 Apps for enterprise Version 2208 (Build 15601.20088 Click-to-Run) Current Channel

@Doug_Robbins_Word_MVP 

This happens on my PC with Office Professional Plus 2016 with Word documents, also I'm almost sure it happens with another version too. The update history says the last one was 16.0.15330.20196 released in June. Word is 2016 MSO (Bersion 2208 build 16.0.15601.20078) 32 bit. The thing which is confusing us is that the issue appears only on the second and subsequent documents. I checked if the file it says comes from a non trusted location already exists but no, it gest created when I try to open the second document from  Visual Foxpro code via

obyWord=CREATEOBJECT("WORD.APPLICATION","")

obyWord.VISIBLE=.T.

obyWord.APPLICATION.WINDOWSTATE=1
obyWord.Documents.Open(pathToDocFile, True, True)

because if I try to open another macro-enalbed doc file with a double click in Windows Explorer I don't get the dialog telling me the macros are being disabled. pathToDocFile points to a file in a folder I added to the Trusted Paths (I'm translating from the italian version) in Office

And it doesn' happen on every PC

 

@Villi_B Try using the following:

 

Dim bstartApp As Boolean
On Error Resume Next
Set objWord = GetObject(, "Word.Application")
If Err Then
    bstartApp = True
    Set objWord = CreateObject("Word.Application")
End If
On Error GoTo 0

'Then, at the end of your code incorporate
If bstartApp = True Then
    objWord.Quit
End If

Doug, this fixed the issue on my PC! I'm giving the modified compiled source to some coworkers right now, fingers crossed but I'm feeling optimistic, thank you very much!
Olá Guilherme, estou com esse mesmo problema. pra mim acontece no comando OLE_NewFile, até tirei a macro do arquivo, mas o Windows não entende, fecha o Protheus, e apresenta a caixa de diálogo com o erro.
Você conseguiu alguma evolução?

oWord := OLE_CreateLink()

OLE_NewFile( oWord, cFileOpen )
As you appear to be using a third party application - TOTVS Microsiga Protheus, I would suggest that you contact the vendor of that application.

@Doug_Robbins_Word_MVP 

 

Still struggling here with the same problem. We call Word from Access. So I’ll have to contact Microsoft or Microsoft. We found that the error message doesn’t appear, when closing all open Word documents before invoking the macro while opening Word from Access. If there is any open Word document (either opened from Access or some other Word document), the macro error reappears. Probably that’s why Villi_B only gets the error message from the second document onwards (see Villi_B above).

 

Versions:

Microsoft Word 2021 MSO (Version 2207 Build 16.0.15427.20182) 64 bits

Microsoft Access 2021 MSO (Version 2207 Build 16.0.15427.20182) 64 bits

 

@Doug_Robbins_Word_MVP 

 

Some additional findings and remarks.

 

Without having any Word document open, Access opens Word without any problem and the macro is executed correctly.

 

If I open an empty Word document before calling Word from Access, the macro error appears. After the error, it’s no problem to execute the very same macro form the empty Word document I opened before. For me this confirms that the problem isn’t in my Access coding.

 

We run everything locally on a PC. No Internet, no network server. Nevertheless Access starts with an error message stating “Execution form server failed”. This is strange because we don’t use any server.

 

I have added screen captures. I use all software in Dutch, but you’ll see what I mean. I am sure you will agree, that these messages are strange not using any files from Internet nor from any other server or network.

 

Check how you open the document from Access: as per Doug's answer to me on Sept 12 at 12:46 AM, my issue came from using createobject() instead of trying first with getobject(), which intercepts the eventual Word.Application instance already open (it works if a doc is open), and then resuming to createobject() if the getobject() fails. That solved my issue which happened only when I already had an open file in Word

@marbel1492 This issue is caused when you use CreateObject to create an instance of Word when the Word application is already running.

 

Modify the code in your Access application so that it uses a construction of the following format to access the existing instance of Word if there is one.

 

Dim bstartApp As Boolean
On Error Resume Next
Set objWord = GetObject(, "Word.Application")
If Err Then
    bstartApp = True
    Set objWord = CreateObject("Word.Application")
End If
On Error GoTo 0

'Then, at the end of your code incorporate
If bstartApp = True Then
    objWord.Quit
End If

 

 

@jaimemfilho  e @guifernandes1607  .. você conseguiu resolver este problema de abrir o WORD pelo Protheus??? fiz vários procedimentos que tem no site na MS mas até agora nao consigo .. tem usuário que funcioana de boa .. tem outros q nao ... 

I would suggest that you take up the issue with Protheus

@Doug_Robbins_Word_MVP .  I want to say thank you for presenting a fix for the macro disabling issue.  The code change from createobject() to getobject() absolutely solved my issue. 

@Doug_Robbins_Word_MVP 

how to use this code?

I face the same issue, but i am a user of a third party macro, not a developer

i don't know how to fix this issue

@shaargo 

You may want to check with the third party. This is an old question that was answered. It may not get many more responses.

I assume you've read the entire question and answers here.

References on using macros found on websites:

You want your macro to be in a document that is trusted by your system. Usually that means in a template in a Trusted Location as set in your Trust Center.

Do not enable all macros to run.

thank you for your reply.
I recently clear the folder C:\Users\(username)\AppData\Local\Microsoft\Windows\INetCache\Content.Word\
and the issue seems to be fixed temporarily
OK, that is clearing your cache.
If this keeps happening, though, I would advise posting a new separate question about it with details.