Forum Discussion
Word Blocked Macros
- Sep 10, 2022What 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
- Villi_BSep 12, 2022Copper Contributor
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
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