Do While xmlSheetFile <> “”
xmlFile = FreeFile
Open zipFilePath & “xl\worksheets\” & xmlSheetFile For Input As xmlFile
xmlFileContent = Input(LOF(xmlFile), xmlFile)
Close xmlFile
xmlStartProtectionCode = 0
xmlStartProtectionCode = InStr(1, xmlFileContent, “<sheetProtection”) If xmlStartProtectionCode > 0 Then
xmlEndProtectionCode = InStr(xmlStartProtectionCode, _
xmlFileContent, “/>”) + 2 ‘”/>” is 2 characters long
xmlProtectionString = Mid(xmlFileContent, xmlStartProtectionCode, _
xmlEndProtectionCode – xmlStartProtectionCode)
xmlFileContent = Replace(xmlFileContent, xmlProtectionString, “”)
End If
xmlFile = FreeFile
Open zipFilePath & “xl\worksheets\” & xmlSheetFile For Output As xmlFile
Print #xmlFile, xmlFileContent
Close xmlFile
xmlSheetFile = Dir
Loop
xmlFile = FreeFile
Open zipFilePath & “xl\workbook.xml” For Input As xmlFile
xmlFileContent = Input(LOF(xmlFile), xmlFile)
Close xmlFile
xmlStartProtectionCode = 0
xmlStartProtectionCode = InStr(1, xmlFileContent, “<workbookProtection”) If xmlStartProtectionCode > 0 Then
xmlEndProtectionCode = InStr(xmlStartProtectionCode, _
xmlFileContent, “/>”) + 2 ””/>” is 2 characters long
xmlProtectionString = Mid(xmlFileContent, xmlStartProtectionCode, _
xmlEndProtectionCode – xmlStartProtectionCode)
xmlFileContent = Replace(xmlFileContent, xmlProtectionString, “”)
End If
xmlStartProtectionCode = 0
xmlStartProtectionCode = InStr(1, xmlFileContent, “<fileSharing”) If xmlStartProtectionCode > 0 Then
xmlEndProtectionCode = InStr(xmlStartProtectionCode, xmlFileContent, _
“/>”) + 2 ””/>” is 2 characters long
xmlProtectionString = Mid(xmlFileContent, xmlStartProtectionCode, _
xmlEndProtectionCode – xmlStartProtectionCode)
xmlFileContent = Replace(xmlFileContent, xmlProtectionString, “”)
End If
xmlFile = FreeFile