Article ID: 179339
Article Last Modified on 11/23/2006
Sub UnlinkFieldsinFooter()
' Switch to document footer.
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or _
ActiveWindow.ActivePane.View.Type = wdOutlineView Or _
ActiveWindow.ActivePane.View.Type = wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
' Select all text in the footer.
Selection.WholeStory
' Loop through fields in selection.
For Each afield In Selection.Fields
' If field type is a REF field.
If afield.Type = wdFieldRef Then
' Unlink the field.
afield.Unlink ' <--- Word stops responding at this line...
End If
' Reselect all text in the footer.
Selection.WholeStory
Next afield
End Sub
Sub UnlinkFieldsinFooter()
' Switch to document footer.
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or _
ActiveWindow.ActivePane.View.Type = wdOutlineView Or _
ActiveWindow.ActivePane.View.Type = wdMasterView Then
ActiveWindow.ActivePane.View.Type = wdPageView
End If
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter
' Select all text in the footer.
Selection.WholeStory
' Loop through fields in selection.
For n = 1 To Selection.Fields.Count
' If the field is a REF field,
If Selection.Fields(1).Type = wdFieldRef Then
' Unlink the field.
Selection.Fields(1).Unlink
End If
' Re-select all text in the footer.
Selection.WholeStory
Next
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
Additional query words: kbdtacode kbmacro vba hang hung crash crashed locks locked frozen freezes crashing quit quits stopped crashes auto lockup freeze break won't respond waiting near memory stops responding hangs lock up fail
Keywords: kbbug kbdtacode kbmacroexample KB179339