5/15/11

How to Remove Word Document Properties in VBA

When a Microsoft Word document is saved, extra information called the Document Properties is also added. The document's creation and modified dates, creator information, administrative data and user comments are just some of the fields found in the Document Properties. VBA, or Visual Basic for Applications, is the programming shell that Microsoft included in all Office applications so that advanced users can make more advanced solutions. You can change the Document Properties programmatically with VBA.
    • 1

      Open the document and show the Developer tab in Word. Click on the "File" tab and "Options." Click on the "Customize Ribbon" category in the categories pane. In the right side under "Main Tabs" select "Developer." Click "OK" to save your changes and close the "Options" dialog box.

    • 2

      Click on the "Developer" tab and the "Visual Basic" button in the "Code" group. The Visual Basic Editor opens in a separate window.

    • 3

      Click on "Insert" and "Module" to start a new module.

    • 4

      Add a new procedure that will change the Document Properties for the Word document that is currently open.

      "Public Sub ChangeProperty()

      ActiveDocument.BuiltInDocumentProperties(wdPropertyTitle).Value = 'Meeting Notes';

      ActiveDocument.BuiltInDocumentProperties(wdPropertyAuthor).Value = 'Jane Doe';

      ActiveDocument.BuiltInDocumentProperties(wdPropertyCompany).Value = 'XYZ Company';

      End Sub"

    • 5

      Add in the line for the property that you want to change. Click the "Save" icon at the top of the Visual Basic Editor to save the module. The above code only changes the Title, Author and Company properties.

  • No comments:

    Post a Comment

    Please do not spam.