Removing rsid information from word XML in VBA

I am trying to translate a bunch of .doc documents to .docx. I am using the script below, which works fine on its own.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Sub TranslateDocIntoDocx()
Dim objWordApplication As New Word.Application
Dim objWordDocument As Word.Document
Dim strFile As String
Dim strFolder As String
strFolder = ""
strFile = Dir(strFolder & "*.doc", vbNormal)
destFolder = ""
While strFile <> ""
With objWordApplication
Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)
With objWordDocument
.SaveAs FileName:=destFolder & Replace(strFile, "doc", "docx"), FileFormat:=16
.Close
End With
End With
strFile = Dir()
Wend
Set objWordDocument = Nothing
Set objWordApplication = Nothing
End Sub
</code>
<code>Sub TranslateDocIntoDocx() Dim objWordApplication As New Word.Application Dim objWordDocument As Word.Document Dim strFile As String Dim strFolder As String strFolder = "" strFile = Dir(strFolder & "*.doc", vbNormal) destFolder = "" While strFile <> "" With objWordApplication Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False) With objWordDocument .SaveAs FileName:=destFolder & Replace(strFile, "doc", "docx"), FileFormat:=16 .Close End With End With strFile = Dir() Wend Set objWordDocument = Nothing Set objWordApplication = Nothing End Sub </code>
Sub TranslateDocIntoDocx()

  Dim objWordApplication As New Word.Application

  Dim objWordDocument As Word.Document

  Dim strFile As String

  Dim strFolder As String

 

  strFolder = ""

  strFile = Dir(strFolder & "*.doc", vbNormal)

  destFolder = ""

 

  While strFile <> ""

    With objWordApplication

      Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)

      With objWordDocument

        .SaveAs FileName:=destFolder & Replace(strFile, "doc", "docx"), FileFormat:=16

        .Close

      End With

    End With

    strFile = Dir()

  Wend

 

  Set objWordDocument = Nothing

  Set objWordApplication = Nothing

End Sub

Except when I do this and then parse the xml, I have a bunch of extraneous rsid tags breaking up words, making the parsing a little more complex. I’m trying to understand how to remove those, but so far haven’t had any success. Below is a modified version of the above code I tried, but didn’t remove the tags.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Sub TranslateDocIntoDocx()
Dim objWordApplication As New Word.Application
Dim objWordDocument As Word.Document
Dim strFile As String
Dim strFolder As String
strFolder = ""
strFile = Dir(strFolder & "*.doc", vbNormal)
destFolder = ""
While strFile <> ""
With objWordApplication
Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)
With objWordDocument
'Remove revisions
.TrackRevisions = False
'.AcceptAllRevisionsShown
.RemoveDocumentInformation wdRDIDocumentProperties
.RemoveDocumentInformation wdRDIRevisions
.RemoveDocumentInformation wdRDIComments
.RemoveDocumentInformation wdRDIRemovePersonalInformation
'Turn off grammar and spell check options
.ShowGrammaticalErrors = False
.ShowSpellingErrors = False
.GrammarChecked = False
.SpellingChecked = False
.SaveAs FileName:=destFolder & Replace(strFile, "doc", "docx"), FileFormat:=16
.Close
End With
End With
strFile = Dir()
Wend
Set objWordDocument = Nothing
Set objWordApplication = Nothing
End Sub
</code>
<code>Sub TranslateDocIntoDocx() Dim objWordApplication As New Word.Application Dim objWordDocument As Word.Document Dim strFile As String Dim strFolder As String strFolder = "" strFile = Dir(strFolder & "*.doc", vbNormal) destFolder = "" While strFile <> "" With objWordApplication Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False) With objWordDocument 'Remove revisions .TrackRevisions = False '.AcceptAllRevisionsShown .RemoveDocumentInformation wdRDIDocumentProperties .RemoveDocumentInformation wdRDIRevisions .RemoveDocumentInformation wdRDIComments .RemoveDocumentInformation wdRDIRemovePersonalInformation 'Turn off grammar and spell check options .ShowGrammaticalErrors = False .ShowSpellingErrors = False .GrammarChecked = False .SpellingChecked = False .SaveAs FileName:=destFolder & Replace(strFile, "doc", "docx"), FileFormat:=16 .Close End With End With strFile = Dir() Wend Set objWordDocument = Nothing Set objWordApplication = Nothing End Sub </code>
Sub TranslateDocIntoDocx()

  Dim objWordApplication As New Word.Application

  Dim objWordDocument As Word.Document

  Dim strFile As String

  Dim strFolder As String

 

  strFolder = ""

  strFile = Dir(strFolder & "*.doc", vbNormal)

  destFolder = ""

 

  While strFile <> ""

    With objWordApplication

      Set objWordDocument = .Documents.Open(FileName:=strFolder & strFile, AddToRecentFiles:=False, ReadOnly:=True, Visible:=False)

      With objWordDocument
        'Remove revisions
        .TrackRevisions = False
        '.AcceptAllRevisionsShown
        .RemoveDocumentInformation wdRDIDocumentProperties
        .RemoveDocumentInformation wdRDIRevisions
        .RemoveDocumentInformation wdRDIComments
        .RemoveDocumentInformation wdRDIRemovePersonalInformation

        'Turn off grammar and spell check options
        .ShowGrammaticalErrors = False
        .ShowSpellingErrors = False
        .GrammarChecked = False
        .SpellingChecked = False
        .SaveAs FileName:=destFolder & Replace(strFile, "doc", "docx"), FileFormat:=16

        .Close

      End With

    End With

    strFile = Dir()

  Wend

 

  Set objWordDocument = Nothing

  Set objWordApplication = Nothing

End Sub

In addition, I tried adding in

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>.StoreRSIDOnSave = False
</code>
<code>.StoreRSIDOnSave = False </code>
.StoreRSIDOnSave = False

But depending on where I placed it either errored out or didn’t remove the rsid tags. Also tried accepting all revisions with either .AcceptAllRevisions or .AcceptAllRevisionsShown but would get error when including them. Does anyone know if there’s a VBA solution for doing this? My environment is pretty limited so I would be looking for a solution in either VBA or base python.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật