3 Quick Methods to Delete a Document or Its Contents in Word

In this article, we plan to show you 3 quick methods to delete a document or its contents in Word as required.

It’s a good habit to clean up your computer by removing useless documents. While deleting files, here are 2 situations you will meet:

  1. Sometimes, we can easily determine whether a document is unneeded with a glance at its name.
  2. Other times, we have no choice but open document and check its contents before finally discard it.

The following 3 methods shall list solutions to the foresaid situations into which you would possible run.

Method 1: Delete a Closed Document

  1. To start with, click “File” tab.
  2. Next click “Open” to trigger the same name window.Click "File"->Click "Open"
  3. Then go to the target folder and select a useless document.
  4. Right click on the document and choose “Delete”.
  5. Click “Yes” in confirmation box.Go to folder->Right Click ->Choose "Delete"

Method 2: Delete an Open Document

Normally, we can’t delete an open document. Yet, we find it’s too annoying that each time a document has to be closed before deletion. To address this issue, we suggest you take the macro way.

  1. First and foremost, you click “Developer” tab.
  2. Click “Visual Basic” next to open invoke VBA editor. Or just press “Alt+ F11” to do so.Click "Developer"->Click "Visual Basic"
  3. Next click “Insert” and then choose “Module” to insert a new one under “Normal” project.Click "Normal"->Click "Insert"->Click "Module"
  4. Then double click the module to open editing space on the right side.
  5. Paste the following macro:
Sub DeleteOpenDoc()
  Dim objDoc As Document
  Dim strDocName As String
  Dim strButtonValue As String
  '  Initialization
  Set objDoc = ActiveDocument
  strDocName = ActiveDocument.FullName
  '  Check if the doc has beed saved.
  If objDoc.Path = "" Then
    MsgBox ("This document hasn't been saved.")
    Exit Sub
  End If
  '  Deletion confirmation
  strButtonValue = MsgBox("Are you sure to delete " & strDocName & "?", vbYesNo)
  If strButtonValue = vbYes Then
    objDoc.Close SaveChanges:=wdDoNotSaveChanges
    KillFile = strDocName
    Kill KillFile
  End If
End Sub
  1. Click “Run”.Paste macro->Click "Run"
  2. Now there will be a confirmation message on a popping up box. Click “Yes”.Click "Yes"

Method 3: Delete Document Contents

There are also times you have saved a document with a name but want to discard all contents. Then the following macro is what you need:

Sub DeleteContents()
  Dim objDoc As Document
  Set objDoc = ActiveDocument
End Sub

Just follow the same steps in method 2 to install and run the macro.

What to do when Word goes wrong

When Word collapses, don’t freak out. Check your important file first and see if there is any corruption. If any, you can try the built-in tool first to recover data from damaged docx. The result, however, is not optimistic in most cases. Therefore, you probably will need a more sophisticated one.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xls recovery and pdf repair software products. For more information visit www.datanumen.com

Comments are closed.