Imports OpenXmlPowerTools Imports DocumentFormat.OpenXml.Packaging Dim lcFile As String = "" ' Initialization lcFile = MicrosoftOfficeFile.Text ' If the file is empty If lcFile.Length = 0 Then MessageBox.Show("The file cannot be empty.", oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Sub End If Using loWordprocessingDocument As WordprocessingDocument = WordprocessingDocument.Open(lcFile, True) Dim loSimplifyMarkupSettings As SimplifyMarkupSettings = New SimplifyMarkupSettings With { .RemoveComments = True, .RemoveContentControls = True, .RemoveEndAndFootNotes = True, .RemoveFieldCodes = False, .RemoveLastRenderedPageBreak = True, .RemovePermissions = True, .RemoveProof = True, .RemoveRsidInfo = True, .RemoveSmartTags = True, .RemoveSoftHyphens = True, .ReplaceTabsWithSpaces = True } MarkupSimplifier.SimplifyMarkup(loWordprocessingDocument, loSimplifyMarkupSettings) End Using MessageBox.Show("The operation completed successfully.", oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Information)You will need to install the two NuGet packages.