Consulting

Results 1 to 1 of 1

Thread: Word "Save Clean" Sub

  1. #1

    Word "Save Clean" Sub

    So, I am trying to write a good "save clean" sub for word 2007/2010, which will get rid of metadata, personal information, etc, etc..

    This was my starting point:

    [vba]'Save File as a Clean Document
    Sub FileSaveAsCleanDeprecated()

    Dim arev As Revision
    Dim StoryRange As Range
    Dim oRange As Range

    With ActiveDocument
    For Each oRange In .StoryRanges
    oRange.Revisions.AcceptAll
    Next
    End With

    For Each cmt In ActiveDocument.Comments
    cmt.Delete
    Next

    For Each StoryRange In ActiveDocument.StoryRanges
    StoryRange.HighlightColorIndex = wdNoHighlight
    Next StoryRange

    Application.Dialogs(wdDialogFileSaveAs).Show
    End Sub[/vba]
    which evolved into this:

    [vba]Sub FileSaveAsClean()

    ActiveDocument.RemoveDocumentInformation wdRDIAll

    For Each StoryRange In ActiveDocument.StoryRanges
    StoryRange.HighlightColorIndex = wdNoHighlight
    Next StoryRange

    Application.Dialogs(wdDialogFileSaveAs).Show

    End Sub[/vba]
    I am also looking for a way to remove a style set used in our documents called "Custom Style Set", and have the text keep its formatting but have the standard word style set loaded.

    Does anyone have any thoughts on how I can make a "save clean" function that will allow me to send word documents to outside parties without worrying about sending information which should otherwise be private? (ex: metadata including, document properties, authors information, editing time, track changes, comments, hidden text, highlights, document variables, "versions" information, fast saves, template information, should I be worried about anything else?)

    Anyone already come up with some good code for a "save clean" function for what seems like a common problem?

    Best,
    Brian
    Last edited by bstephens; 09-14-2010 at 12:40 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •