Forum Discussion
Word Blocked Macros
Você conseguiu alguma evolução?
oWord := OLE_CreateLink()
OLE_NewFile( oWord, cFileOpen )
- Cristian1690Dec 09, 2022Copper Contributor
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, 2022I would suggest that you take up the issue with Protheus
- Sep 13, 2022As you appear to be using a third party application - TOTVS Microsiga Protheus, I would suggest that you contact the vendor of that application.
- marbel1492Sep 14, 2022Copper Contributor
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
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
- marbel1492Sep 14, 2022Copper Contributor
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