Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2015, 07:14 PM
bkcell bkcell is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2007
Advanced Beginner
corrupted source list?
 
Join Date: Jul 2011
Posts: 35
bkcell is on a distinguished road
Default corrupted source list?


i am working on a 190k word (so far) document with 137 citations. at some point it becomes impossible to update the source list. after laboring for .5hr or so it crashes Word. I've uninstalled and reinstalled both Word 2007 and 2013. I could probably recover an older version of the file before this problem but then would have to figure out to merge the new data into it, maybe doable, maybe not. if i can't fix this i'll have to freeze the existing source structure (convert to static text) then manage sources manually until completion. any suggestions greatly appreciated.
Reply With Quote
  #2  
Old 09-15-2015, 09:25 PM
macropod's Avatar
macropod macropod is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
FWIW, the Sources.xml file is usually stored at:
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]
Reply With Quote
  #3  
Old 09-16-2015, 06:34 PM
bkcell bkcell is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2007
Advanced Beginner
corrupted source list?
 
Join Date: Jul 2011
Posts: 35
bkcell is on a distinguished road
Default

sorry, i should've said a 190KB-word "Word" document. the file size is about 3MB.

interesting. i found the sources.xml file at

C:\Users\%Username%\AppData\Roaming\Microsoft\Bibl iography

decided to make a copy of the working file to play with, then went back
to the above location to delete the .xml and...it was gone? no change
in behavior when updating references in the working or copy files. i have a dumb
(text) copy of the references.

being the functional equivalent of a novice user, i'll have to take the time to
learn how to run macros to try your solution and get back to you. Thanks much.

on another note: where would one look for a MS Word pro who could solve problems like this as a service?
Reply With Quote
  #4  
Old 09-16-2015, 08:01 PM
bkcell bkcell is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2007
Advanced Beginner
corrupted source list?
 
Join Date: Jul 2011
Posts: 35
bkcell is on a distinguished road
Default

I meant of course 190K
Reply With Quote
  #5  
Old 09-16-2015, 09:03 PM
macropod's Avatar
macropod macropod is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm

On a side note, it's also possible the document has acquired some for of corruption or that your Office installation is itself faulty.

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.

You could also try repairing the Office installation (via Start > Windows Control Panel > Programs > Programs & Features > Microsoft Office (version) > Change).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 09-28-2015, 08:20 AM
bkcell bkcell is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2007
Advanced Beginner
corrupted source list?
 
Join Date: Jul 2011
Posts: 35
bkcell is on a distinguished road
Default

where can i find this SourceImport macro to which you referred? also, is there an easy way to convert all citation references in a doc to text? thx
Reply With Quote
  #7  
Old 09-29-2015, 03:47 AM
macropod's Avatar
macropod macropod is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

It's in post #2...

Do note that it's only designed for importing references in the xml format Word uses - which is what the SourcesExport macro produces.

The following macro converts a document’s Citations & Bibliography to static text. Note the use of WordBasic ! for this. Note also that converting a Bibliography to static text does not remove it’s building block container – a form of content control. A trivially-simple alternative is to save the file in Word's doc format.
Code:
Sub References_Unlink()
Dim Fld As Field, FtNt As Footnote, EndNt As Endnote
With ActiveDocument
  For Each Fld In .Fields
    If Fld.Type = wdFieldCitation Then
      Fld.Select
      WordBasic.BibliographyCitationToText 
    ElseIf Fld.Type = wdFieldBibliography Then
      Fld.Select
      WordBasic.BibliographyCitationToText
    End If
  Next
  For Each FtNt In .Footnotes
    For Each Fld In FtNt.Range.Fields
      If Fld.Type = wdFieldCitation Then
        Fld.Select
        WordBasic.BibliographyCitationToText
      End If
    Next
  Next
  For Each EndNt In .Endnotes
    For Each Fld In EndNt.Range.Fields
      If Fld.Type = wdFieldCitation Then
        Fld.Select
        WordBasic.BibliographyCitationToText
      End If
    Next
  Next
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 10-16-2015, 04:12 PM
bkcell bkcell is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2007
Advanced Beginner
corrupted source list?
 
Join Date: Jul 2011
Posts: 35
bkcell is on a distinguished road
Default

saving as a .doc is genius! did exactly what i needed without buggering the formatting or anything else. giving up completely on Word referencing for performance reasons. things are moving along relatively apace with those ref's removed.

thanks very much. case closed.
Reply With Quote
  #9  
Old 10-16-2015, 04:48 PM
macropod's Avatar
macropod macropod is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

FWIW, I have at least one document with over 100 citations, plus 67 bibliography references, and those have little effect on its performance. I suspect something else is/was going on with your document.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #10  
Old 10-16-2015, 10:40 PM
bkcell bkcell is offline corrupted source list? Windows 7 64bit corrupted source list? Office 2007
Advanced Beginner
corrupted source list?
 
Join Date: Jul 2011
Posts: 35
bkcell is on a distinguished road
Default

anything's possible after a clean windows installation. for some reason if not the above things are MUCH faster and the incessant repaginating has stopped. depending on how long i live, the source list will grow indefinitely and i no longer trust word's system...i'm glad it's gone. fortunately this isn't a dissertation--source sequencing is hardly a concern. thanks again.
Reply With Quote
  #11  
Old 10-17-2015, 09:53 PM
Guessed's Avatar
Guessed Guessed is offline corrupted source list? Windows 7 32bit corrupted source list? Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The Bibliography in a docx/docm is stored as a CustomXMLPart and this can be extracted to an xml file if you wanted to save all those items in a structured file format which can be edited with text editors or xml tools and then placed back into the document. The following code would extract that file to the same folder as the document.
Code:
Sub WriteBibliographyToFile()
  Dim xmlPart As CustomXMLPart
  Dim sFilename As String
  
'  For Each xmlPart In ActiveDocument.CustomXMLParts
'    Debug.Print xmlPart.ID & vbTab & xmlPart.NamespaceURI
'  Next xmlPart
  
  Set xmlPart = ActiveDocument.CustomXMLParts.SelectByNamespace("http://schemas.openxmlformats.org/officeDocument/2006/bibliography").Item(1)
  If Not xmlPart Is Nothing Then
    sFilename = ActiveDocument.Path & "\Bibliography.xml"
    'Debug.Print xmlPart.XML
    Call WriteStringToFile(sFilename, xmlPart.XML)
  End If

End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
  Dim intFileNum As Integer
  intFileNum = FreeFile
  Open pFileName For Output As intFileNum
    Print #intFileNum, pString
  Close intFileNum
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
corrupted source list? Urgent: Multi Level List issues with list levels becoming "corrupted?" beanie Word 5 05-24-2014 10:04 AM
Citations Source Manager Master List empty! rachetta Word 16 08-07-2012 03:30 PM
corrupted source list? drop down list from external data source Excel 2007? Intruder Excel 1 08-03-2012 05:41 AM
Corrupted strike Office 0 05-15-2010 03:28 PM
corrupted source list? Installation Source Corrupted browneyes Office 1 01-23-2006 02:33 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft