WORDの作者名を消す

作成者のプロパティを消します。
プログラムはEXCELマクロで書いています

Visual Basic画面のツールから参照設定で「MicrosoftWord 16.0 Object Library」を追加してください。

Function reset(Path As String)
    Dim oWord As Word.Application
    Dim oDoc As Document
    Set oWord = New Word.Application
    Set oDoc = oWord.Documents.Open(Path)
    oDoc.RemoveDocumentInformation (wdRDIRemovePersonalInformation)
    oDoc.Save
    oDoc.Close
    oWord.Quit
End Function

Sub start()
    Dim M_SHEET As Range
    Dim i As Integer
    Set M_SHEET = Range("A1")
    M_SHEET.Offset(0, 0) = "ファイル名一覧"
    Filename = Dir(ThisWorkbook.Path & "\*.docx")
    i = 1
    While Filename <> ""
        M_SHEET.Offset(i, 0) = Filename
        reset (ThisWorkbook.Path & "\" & Filename)
        i = i + 1
        Filename = Dir()
    Wend
End Sub

カテゴリー: プログラム, 仕事 タグ: , , パーマリンク