Unfortunately, I have the problem that for each file, two dialogs always come up where I have to grant Word additional permissions for the file. I have already given Word full disk access, but unfortunately it still doesn't work. Could someone help me here? I am a total beginner unfortunately.
I have the same problem with this macro that merges all subdocuments in a folder to one "Master" document. I have granted Ms Word full disk access. Nevertheless I have to grant each and every subdocument access. I consider this a bug in Ms Word. In a different context, some drastic solutions have been suggested. I will try these on my test Mac.
Hey @Atompersona, when everything fails, you can use this simple macro. First you open all docx files to convert. Then you run this macro on every document:
Sub SaveActiveDocumentAsPdf()
On Error GoTo Errhandler
If InStrRev(ActiveDocument.FullName, ".") <> 0 Then
Dim strPath As String
strPath = Left(ActiveDocument.FullName, InStrRev(ActiveDocument.FullName, ".") - 1) & ".pdf"
ActiveDocument.SaveAs2 FileName:=strPath, FileFormat:=wdFormatPDF
End If
ActiveDocument.Close
On Error GoTo 0
Exit Sub
Errhandler:
MsgBox "There was an error saving a copy of this document as Pdf. " & _
"Ensure that the Pdf is not open for viewing and that the destination path is writable. Error code: " & Err
End Sub
You just open this macro in the VBA editor and you click the run triangle until no document is open anymore .
I received an email from Ron de Bruin about how to fix/avoid the issue. He pointed me to this page on his website. It contains two links to pages with useful info.
The good thing about automation of Word for Mac is that you can also control Word via AppleScript (there is a thick manual about this topic!).