![]() |
|
#1
|
||||
|
||||
![]()
The first thing to do is to make a backup of your bibliography references. Assuming they're all replicated in Word's Sources.xml file, you can make a copy of that or use the following SourcesExport macro to extract them to text in a new document:
Code:
Sub SourcesExport() Dim oSrc As Source, StrSrc As String With ActiveDocument .Range.Text = vbNullString For Each oSrc In Application.Bibliography.Sources StrSrc = StrSrc & vbCr & oSrc.XML Next .Range.InsertAfter StrSrc .Paragraphs.First.Range.Delete End With End Sub Sub SourcesImport() Dim i As Long 'In case the source is already present On Error Resume Next With ActiveDocument For i = 0 To UBound(Split(.Range.Text, vbCr)) Application.Bibliography.Sources.Add Split(.Range.Text, vbCr)(i) Next End With End Sub C:\Users\%Username%\AppData\Roaming\Microsoft\ Putting that string into Windows Explorer's address bar should take you to the folder on your system. A 190KB Word document is quite small, so you're a long way from pressing up against any operating limits. It's possible, though, that the document has acquired some for of corruption. Corrupt documents can often be 'repaired' by inserting a new, empty, paragraph at the very end, copying everything except that new paragraph to a new document based on the same template (headers & footers may need to be copied separately), closing the old document and saving the new one over it. If that doesn't resolve things, try closing Word, then deleting the Sources.xml file (which may be corrupt), before re-starting Word. Word should create a new one and you can then use the SourcesImport macro to restore the bibliography entries to it. Hopefully the problem will now go away. The 137 citations could adversely affect the document's performance, too, because of the way Word handles their building block containers. A way around this is to replace the existing building block citations with citation fields - and do the same to the bibliography. The following macro does just that. Code:
Sub DeleteReferenceBuilingBlocks() Application.ScreenUpdating = False Application.DisplayAlerts = wdAlertsNone Dim i As Long, iRng As Long, StrCode As String Dim Stry As Range, Rng As Range, Fld As Field, Stl As String With ActiveDocument For Each Stry In .StoryRanges Select Case Stry.StoryType Case wdFootnotesStory, wdEndnotesStory, wdMainTextStory 'loop through all fields, starting from the end of the story For i = Stry.Fields.Count To 1 Step -1 With Stry.Fields(i) 'get the field type If .Type = wdFieldCitation Then StrCode = Trim(.Code.Text) Set Rng = .Result.Duplicate iRng = Len(Rng.Text) .Select WordBasic.BibliographyCitationToText Rng.MoveEnd wdCharacter, iRng If Rng.Characters.First.Previous = " " Then Rng.Start = Rng.Start - 1 End If Set Fld = Rng.Fields.Add(Range:=Rng, Type:=wdFieldEmpty, _ Text:="REF " & StrCode, Preserveformatting:=False) Fld.Code.Text = Trim(Replace(Fld.Code.Text, "REF ", "")) ElseIf .Type = wdFieldBibliography Then StrCode = Trim(.Code.Text) Set Rng = .Result.Duplicate With Rng .MoveStart wdParagraph, -2 Stl = .Paragraphs(1).Style .Start = .Start - 1 .End = .End + 2 .Text = vbNullString .Collapse wdCollapseStart .Text = vbCr & "Bibliography" & vbCr .Paragraphs(2).Style = Stl .Collapse wdCollapseEnd End With Set Fld = Rng.Fields.Add(Range:=Rng, Type:=wdFieldEmpty, _ Text:=StrCode, Preserveformatting:=False) End If End With Next Stry.Fields.Update Case Else End Select Next End With Set Rng = Nothing: Set Fld = Nothing Application.DisplayAlerts = wdAlertsAll Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
beanie | Word | 5 | 05-24-2014 10:04 AM |
Citations Source Manager Master List empty! | rachetta | Word | 16 | 08-07-2012 03:30 PM |
![]() |
Intruder | Excel | 1 | 08-03-2012 05:41 AM |
Corrupted | strike | Office | 0 | 05-15-2010 03:28 PM |
Installation Source Corrupted | browneyes | Office | 1 | 01-23-2006 02:33 PM |