How to Destroy Word Documents

Written by launie sorrels | 13/05/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.

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.