DISCOVER
×

How to Destroy Word Documents

Updated February 21, 2017

Destroying a Word document is not the same thing as deleting one. When a user deletes a document, he removes the file from the hard drive. Destroying a document is when developers remove the document from memory. A programmer will open a document in memory and make needed changes before closing and deleting the document. When he opens the document it does not open visually; instead the document is hidden at a memory address. If the document is not destroyed then it will continue to reside in that memory address.

Write the code to open the Word document and make whatever changes you need.

Locate the ending of the code where you close the document.

Destroy the Word document with the following code:

Set doc Name = nothing

The doc Name is the name of the Word document you have been working with.

Cite this Article A tool to create a citation to reference this article Cite this Article

About the Author

Launie Sorrels is a veteran who has worked as a chef and has more than two decades of martial arts training. His writing has developed from his experience as a quality assurance manager for Microsoft and IBM. Sorrels has a degree in computer science and is currently working on his journalism degree.