In this post, we are going to show 4 fast ways for you to remove undesired frames in your Word document.
To some degree, frames are very must the same like text boxes, both used to holding texts in a document. But frames have some advantages over text boxes. For example, it can contain some fields and you can start footnotes or endnotes inside, either of which works in text boxes.
Despite this, we can’t ignore the need to remove frames you just don’t want anymore. Therefore, we offer you 4 easy but quick ways as below:
Method 1: Remove Frames Manually
- Firstly, right click on a frame border.
- Then choose “Format Frame” on the contextual menu.
- Next in the “Frame” box open, click the “Remove Frame” tab.
Method 2: Remove All Frames in a Selection
As you see, it’s tedious to remove multiple frames one by one with steps in method 1. To save your time, a quicker approach would be to use the VBA codes.
- First of all, make a selection over a range of texts containing frames.
- Secondly, press “Alt+ F11” to open VBA editor.
- Next click “Normal” project and then click “Insert”.
- On the drop-down menu, select “Module”.
- Open the module by double click and paste following codes there:
Sub RemoveAllFramesInSelection() Dim objFrame As frame Dim nFrame As Long Application.ScreenUpdating = False nFrame = Selection.Frames.Count For Each objFrame In Selection.Frames objFrame.Delete Next objFrame MsgBox ("All " & nFrame & " frames in this selection have been removed!") Application.ScreenUpdating = True End Sub
- Finally, click “Run” button or hit “F5” to execute codes.
You will receive a message box, indicating you the result, such as below:
Method 3: Remove All Frames in Current Document
Still, we will need a macro to do the batch processing.
- Install and run a macro with steps in method 2.
- Then replace that macro with this one:
Sub RemoveAllFramesInDoc() Dim objFrame As frame Dim nFrame As Long Application.ScreenUpdating = False nFrame = ActiveDocument.Frames.Count For Each objFrame In ActiveDocument.Frames objFrame.Delete Next objFrame MsgBox ("All " & nFrame & " frames in this document have been removed!") Application.ScreenUpdating = True End Sub
Similarly, you will be notified with a message box once the process is over.
Method 4: Remove All Frames in Multiple Documents from a Folder
In case you have a batch of documents all including frames, we also provide a macro to do the task.
- Paste and run these codes in VBA module:
Sub RemoveAllFramesInAllDocsInFolder() Dim objDoc As Document Dim dlgFile As FileDialog Dim nFile As Integer Dim objFrame As frame Dim nFrame As Long Set dlgFile = Application.FileDialog(msoFileDialogFilePicker) With dlgFile dlgFile.AllowMultiSelect = True If .Show = -1 Then For nFile = 1 To dlgFile.SelectedItems.Count Documents.Open dlgFile.SelectedItems(nFile) Set objDoc = ActiveDocument nFrame = ActiveDocument.Frames.Count For Each objFrame In ActiveDocument.Frames objFrame.Delete Next objFrame objDoc.Save objDoc.Close Next nFile Else MsgBox "No file is selected! Please select a target file." Exit Sub End If End With End Sub
- Now you will trigger the “Browse” window. Select target documents and click “Open”. Then in seconds, you will have all frames in selected documents removed.
Overcome Data Disaster
Needless to say, data disaster is by no means horrible. It can even be a career threat to some extent. So to safeguard data and know the right action to take after data loss happens is of vital importance. One of the advisable measures is to get hold of a docx fix tool in advance.
Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xlsx fix and pdf repair software products. For more information visit www.datanumen.com