Sep 06 2022 04:43 AM
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
Sep 07 2022 11:27 AM
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.
Sep 09 2022 07:32 AM
Sep 10 2022 01:40 AM
Sep 11 2022 11:05 PM - edited Sep 11 2022 11:36 PM
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
Sep 12 2022 12:46 AM
@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
Sep 13 2022 01:49 AM
Sep 13 2022 01:14 PM
Sep 13 2022 02:53 PM
Sep 14 2022 12:53 AM
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
Sep 14 2022 01:53 AM
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.
Sep 14 2022 02:15 AM
Sep 14 2022 04:58 AM - edited Sep 15 2022 04:40 PM
@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
Dec 09 2022 09:58 AM
@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 ...
Dec 09 2022 01:58 PM
Feb 08 2023 03:59 PM
@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.
Dec 06 2023 06:45 PM - edited Dec 06 2023 06:58 PM
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
Dec 06 2023 07:46 PM
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.
Dec 06 2023 07:50 PM
Dec 06 2023 08:52 PM