709-218-7927 The Landfall Garden House 60 Canon Bayley Road CANADA A0C 1B0 |
---|
Rebuild your Active Document
Wednesday, August 31, 2011
Your document is corrupt, or it is so heavily edited that it is behaving badly.
Use the little macro "RebuildActiveDocument" to grab all your text, unformatted, and rebuild the document.
CAUTION: make a copy of your document using Windows Explorer before running this macro.
Sub RebuildActiveDocument()' Get the name of the source ActiveDocumentument
Dim strFilename As String
strFilename = ActiveDocument.FullName
' Get the stoty-content of the ActiveDocumentument
Dim strStoryContent As String
Dim lng As Long
For lng = 1 To ActiveDocument.StoryRanges.Count
strStoryContent = strStoryContent & ActiveDocument.StoryRanges(lng).Text
Next lng
' Close the ActiveDocumentument WITHOUT saving changes
ActiveDocument.Close (wdDoNotSaveChanges)
' Create a new ActiveDocumentument
Documents.Add
' Insert the text file
Selection.TypeText (strStoryContent)
' Save the ActiveDocumentument with the original name
ActiveDocument.SaveAs (strFilename)
End Sub
7092187927 CPRGreaves@gmail.com Bonavista, Friday, December 04, 2020 5:55 PM Copyright © 1996-2020 Chris Greaves. All Rights Reserved. |
---|