Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2008
    Location
    New York, New York, USA
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word 2010 Crashes in Footnotes

    Hi,
    I see that this problem has been posted in several different message boards, but no one has offered a satisfactory solution. Most seem to date back to 2010, so I'm hoping someone may have found a solution since then.

    The basic problem is that in performing Find in the "Footnotes" or "Endnotes" story, Word randomly crashes (sometimes it doesn't, but usually it does).

    This only occurs when I perform the searches in a macro. However the macro I'm running is very simple, and has been basically unchanged since Word 2003, and this has never been a problem in those versions.

    I'm pasting an abridged version of the macro below, basically just starting at the point where it seems to start crashing. All the searches before this are simple Find/Replace or Find -> Loop with a simple replace. So I really don't think the code is causing it.

    Does anyone have any ideas for a workaround?

    Thanks!
    John

    Sub Cleanup()

    Application.ScreenUpdating = False

    ' Application.ScreenUpdating = False
    Selection.HomeKey unit:=wdStory
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With


    ' change italic character roman period to italic character and period
    With Selection.Find
    .ClearFormatting
    .Text = "^?."
    .Execute
    End With
    Do
    If Selection.Characters(1).Italic = True Then Selection.Characters(2).Italic = True
    Loop Until Selection.Find.Execute = False
    Selection.HomeKey unit:=wdStory

    ' remove bold formatting from tabs
    With Selection.Find
    .ClearFormatting
    .Font.Bold = True
    .Replacement.ClearFormatting
    .Replacement.Font.Bold = False
    End With
    With Selection.Find
    .Text = "^t"
    .Replacement.Text = "^t"
    .Format = True
    .Execute Replace:=wdReplaceAll
    End With

    ' remove italic formatting from tabs
    With Selection.Find
    .ClearFormatting
    .Font.Italic = True
    .Replacement.ClearFormatting
    .Replacement.Font.Italic = False
    End With
    With Selection.Find
    .Text = "^t"
    .Replacement.Text = "^t"
    .Format = True
    .Execute Replace:=wdReplaceAll
    End With

    Dim EllipsisString, EllipsisPeriodString As String
    If System.OperatingSystem = "Macintosh" Then
    EllipsisPeriodString = "." & Chr(202) & "." & Chr(202) & "." & Chr(202) & "."
    EllipsisString = "." & Chr(202) & "." & Chr(202) & "."
    Else:
    EllipsisPeriodString = "." & Chr(160) & "." & Chr(160) & "." & Chr(160) & "."
    EllipsisString = "." & Chr(160) & "." & Chr(160) & "."
    End If


    ' fix ellipses
    With Selection.Find
    .ClearFormatting
    .Text = ". . . ."
    .Replacement.ClearFormatting
    .Replacement.Text = "." & EllipsisString
    .Execute Replace:=wdReplaceAll
    End With


    With Selection.Find
    .ClearFormatting
    .Text = ". . ."
    .Replacement.ClearFormatting
    .Replacement.Text = EllipsisString
    .Execute Replace:=wdReplaceAll
    End With

    ' change closed up ellipses to opened up ellipses
    Do
    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "..."
    .Replacement.Text = EllipsisString
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .Font.NameAscii = "Arial"
    .Execute Replace:=wdReplaceAll
    End With
    Loop Until Selection.Find.Execute = False

    Do
    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "..."
    .Replacement.Text = EllipsisString
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .Font.NameAscii = "Times New Roman"
    .Execute Replace:=wdReplaceAll
    End With
    Loop Until Selection.Find.Execute = False

    Selection.Find.ClearFormatting

    With Selection.Find
    .ClearFormatting
    .Text = "…."
    .Replacement.ClearFormatting
    .Replacement.Text = EllipsisPeriodString
    .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
    .ClearFormatting
    .Text = ".…"
    .Replacement.ClearFormatting
    .Replacement.Text = EllipsisPeriodString
    .Execute Replace:=wdReplaceAll
    End With
    With Selection.Find
    .ClearFormatting
    .Text = "…"
    .Replacement.ClearFormatting
    .Replacement.Text = EllipsisString
    .Execute Replace:=wdReplaceAll
    End With

    ' change double periods to single periods
    Do
    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ".."
    .Replacement.Text = "."
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .Font.NameAscii = "Arial"
    .Execute Replace:=wdReplaceAll
    End With
    Loop Until Selection.Find.Execute = False

    Do
    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = ".."
    .Replacement.Text = "."
    .Forward = True
    .Wrap = wdFindContinue
    .Format = True
    .Font.NameAscii = "Times New Roman"
    .Execute Replace:=wdReplaceAll
    End With
    Loop Until Selection.Find.Execute = False

    Selection.Find.ClearFormatting

    ' change tab tab to tab
    With Selection.Find
    .Text = "^t^t"
    .Replacement.Text = "^t"
    End With
    Do
    Selection.Find.Execute Replace:=wdReplaceAll
    Loop Until Selection.Find.Execute = False
    Selection.HomeKey unit:=wdStory


    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .Text = "^t^p"
    .Forward = True
    .Wrap = wdFindStop
    .Execute
    End With

    Do While Selection.Find.Found

    With Selection
    '.MoveRight unit:=wdCharacter, Count:=1
    .MoveLeft unit:=wdCharacter, count:=1
    .Extend
    .MoveRight unit:=wdCharacter, count:=1
    'Selection.TypeText Text:="~"
    'Selection.MoveLeft unit:=wdCharacter, Count:=1
    Selection.Delete
    Selection.ExtendMode = False
    End With

    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .Text = "^t^p"
    .Forward = True
    .Wrap = wdFindStop
    .Execute
    End With

    Loop

    Next


    End Sub

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Star Lounger
    Join Date
    Feb 2011
    Location
    Washington, DC
    Posts
    86
    Thanks
    5
    Thanked 5 Times in 5 Posts
    What error message do you get, if any?

    What is the goal of your macro?

    What happens if you go step by step and trace execution? Anything interesting happening to any of the variables?

    If the crashes are truly random, I would suspect that some memory buffer is filling up.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •