![]() |
|
#1
|
|||
|
|||
|
Hello,
I have a Word file with multiple linked items, mostly cells with words or numbers, from an Excel file, and I noticed that old links leading to now empty cells still exist. This happened because the Excel file evolved over time and the Word file got its fields updated, hence I was not able to see the previous link to delete it, as there was nothing visible where the linked item used to be. Field Shading does not shade these links to the blank Excel cells, and they are near impossible to trace since they seem to take no space, but are visible through Alt + F9 - this is how I caught a couple, since I saw a link in a place where there should be none. However, due to the fact there are areas where there are multiple links stacked together, I cannot identify which should be there and which should not. Is there a way to track these links to empty cells and eliminate them? For example, highlight links to empty cells? Thank you in advance. |
|
#2
|
||||
|
||||
|
You could use a macro like the following to delete all LINK fields whose result is effectively nothing:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
For i = Fields.Count To 1 Step -1
With .Fields(i)
If .Type = wdFieldLink Then
If Trim(.Result) = "" Then .Delete
End If
End With
Next
End With
Application.ScreenUpdating = True
End Sub
For Mac macro installation & usage instructions, see: http://word.mvps.org/Mac/InstallMacro.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
This seems to work, thank you for your time and happy new year!
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Excel-find cells that contain all upper cas
|
Mamadukes2007 | Excel | 2 | 02-06-2016 02:17 AM |
| Find and list Blank pages in Word document. | ndandge | Word VBA | 4 | 11-29-2015 09:15 PM |
locking word table cells while auto-updating fields
|
fingermouse | Word | 6 | 01-14-2015 06:22 AM |
How to make Excel stop treating blank cells as zero
|
Chuck_Ds | Excel | 10 | 01-13-2015 08:33 AM |
Excel VBA - Mandatory cells cannot stay blank?
|
hussnainh8 | Excel | 9 | 12-28-2014 09:40 AM |