word 2010 crashes with find excute in hidden RRS feed

  • Question

  • Greetings all,,

    I have this problem since word 2010 crashes when I run  a macro that searches in hidden text in footnote:

    here is the sample, any thoughts are apprciated, thank you in advance.

    ActiveWindow.ActivePane.View.ShowAll = True

    Selection.Find.Execute FindText:="@", Forward:=False, MatchWildcards:=False, Wrap:=wdFindStop

     her is the complete macro

    Set MyRange = ActiveDocument.StoryRanges(wdFootnotesStory)
    ActiveWindow.View.SplitSpecial = wdPaneFootnotes
    dx4 = "04-names:"
    With Selection.Find
        .Forward = True
        .Wrap = wdFindStop
        .Execute FindText:="@"
    End With
    If Selection.Find.Found = False Then GoTo 3 Else
    Selection.Delete Unit:=wdCharacter, Count:=1

    With Selection
    .MoveEndUntil Cset:="@", Count:=wdForward
    End With
    ActiveDocument.Indexes.MarkEntry Range:=Selection.Range, Entry:=dx4 & Selection.Range.Text
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.Delete Unit:=wdCharacter, Count:=1
    ActiveWindow.ActivePane.View.ShowAll = True

    Selection.Find.Execute FindText:=dx4, Forward:=False, MatchWildcards:=False, Wrap:=wdFindStop
    Selection.MoveRight Unit:=wdCharacter, Count:=1

    With Selection
    .MoveEndUntil Cset:="""", Count:=wdForward
    End With
    Set MyRange = Selection
    If Selection.Type = 2 Then
    MyRange.Find.Execute FindText:=":", REPLACEWITH:=" ", Forward:=False, Format:=True, Wrap:=wdFindStop, Replace:=wdReplaceAll
    MyRange.Find.Execute FindText:="  ", REPLACEWITH:=" ", Forward:=False, Format:=True, Wrap:=wdFindStop, Replace:=wdReplaceAll
    End If
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    ActiveWindow.ActivePane.View.ShowAll = False
    GoTo 1
    End Sub


    the problem seems to occure when the find command is executed while hidden text in the foot note is shown.

    moreover, I used find replace while the hidden text is shown with no proplems, however, after that, I hide the hidden  text and used the find command and it crahes in a random fashion!


    • Edited by saudaqeel Wednesday, January 25, 2012 5:09 PM
    Wednesday, January 25, 2012 3:44 PM

All replies

  • Hi,

    Thanks for your post.

    But the issue as your description can't be reproduced on my side, would you like to upload this issue workbook along with the procedure into your skydrive and post back a link here.

    In addition, would you like to tell us your Office version, 32-bit or 64-bit, and up-to-dated?

    I look forward to hearing of you.

    Calvin Gao[MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 27, 2012 8:12 AM