Powershell and Word - how to let it change settings

Hi There! I am currently automating some word workflows, like removing track changes and comments. One thing I was not able to work out : When I remove the comments from a word document, but not the track changes - and the word document still has the setting enabled to show the comment balloons, I will receive a PDF document with the comment bar on the right site, showing the formatting infos. However I want to let Powershell activate the function “Show Markup / Balloons / Show all revisions inline” to deactivate the balloons - before the pdf is being created.

currently I am using this script:


elseif ($choice -eq "2") {
    Write-Host "deleting all comments"
#Script for removing comments
    $folderPath = "C:\ICF Tool"

# Get all .docx files within the folder
$docxFiles = Get-ChildItem -Path $folderPath -Filter "*.docx" -Recurse

# Create an instance of Word Application COM object
$wordApp = New-Object -ComObject Word.Application

foreach ($file in $docxFiles) {
    # Open the document using Word Application
    $document = $wordApp.Documents.Open($file.FullName)
$document.ActiveWindow.View.RevisionsBalloonShowAll = $false

    # Delete all comments from the document
    foreach ($comment in $document.Comments) {
        $comment.Delete()
    }

    # Save and close the document
    $document.Save()
    $document.Close()

    Write-Host "Comments deleted from $($file.BaseName)"

the additional code I have added was:

 $document.ActiveWindow.View.RevisionsBalloonShowAll = $false

to deactivate that view but it is not working. Is there a way or list with which I am able to find the correct command for powershell how to turn on that function? (or turn off the balloon option)

I think your going to have to play around a bit as there are a TON of properties for Word automation. This might get you started.