Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
OK, maybe it's not posible in VBA to 'view' one type of object as another object so I tried something else.
I have this snippet of code:
Sub prepareDoc(fn As String)
Dim WordApp As New Word.Application
Dim doc As Document
Set doc = WordApp.Documents.Open(fn) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< (A)
InsertAndUpdateFieldsInFooter doc
doc.Save
doc.Close
Set doc = Nothing
WordApp.Quit
Set WordApp = Nothing
End Sub
I know for a fact that:
- "InsertAndUpdateFieldsInFooter doc" works as designed because I use it from an event I've set up in Word.
- My code for traversing the folder hieraki and returning med file names one by one of the Word files in the folder hieraki works too because I've tested that it returnes all the Word files names in the folder hieraki.
The ONLY thing left now is to "open the returned file name in a hidden Word instance, do the editing of the footer, save the document and quit Word application.
I think the code above is "by the book" and it should do that ...
but the line marked (A) above wont let me do it - it starts an instanse with this dialog locking it all up:
and I CANT do something about that in the "Security center ..." - I've tried, it makes NO difference !
SOMETHING is wrong here - but what is it ?