Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
EKH EKH is offline
external usenet poster
 
Posts: 15
Default Word 2007 Find and Replace Command fails

When searching for text in a document, the Find and Replace command fails
after being used repeatedly to find a large number (50 or more) of phrases.
I have not noticed this problem in previous versions of Word. Any ideas as
to why this happens?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2007 Find and Replace Command fails

It is a bit difficult to reproduce this, or account for the issue, but the
following macro when used with a table of 80 entries does not baulk at the
replacements:

Sub ReplaceFromTableList()

Dim ChangeDoc As Document, RefDoc As Document
Dim cTable As Table
Dim oldPart As Range, newPart As Range
Dim i As Long

Set RefDoc = ActiveDocument
Set ChangeDoc = Documents.Open("D:\My Documents\Test\changes.doc")
Set cTable = ChangeDoc.Tables(1)
RefDoc.Activate
For i = 1 To cTable.Rows.Count
Set oldPart = cTable.Cell(i, 1).Range
oldPart.End = oldPart.End - 1
Set newPart = cTable.Cell(i, 2).Range
newPart.End = newPart.End - 1
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Execute findText:=oldPart, _
ReplaceWith:=newPart, _
replace:=wdReplaceAll, _
MatchWildcards:=False, _
Forward:=True, _
Wrap:=wdFindContinue
End With
End With
Next i
ChangeDoc.Close wdDoNotSaveChanges
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



EKH wrote:
When searching for text in a document, the Find and Replace command
fails after being used repeatedly to find a large number (50 or more)
of phrases. I have not noticed this problem in previous versions of
Word. Any ideas as to why this happens?



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
EKH EKH is offline
external usenet poster
 
Posts: 15
Default Word 2007 Find and Replace Command fails

Thanks much! I can't recreate the problem now either. But I'll keep this on
hand for the next time it appears.

Another question, is it possible to display the table entries (with VBA)?

"Graham Mayor" wrote:

It is a bit difficult to reproduce this, or account for the issue, but the
following macro when used with a table of 80 entries does not baulk at the
replacements:

Sub ReplaceFromTableList()

Dim ChangeDoc As Document, RefDoc As Document
Dim cTable As Table
Dim oldPart As Range, newPart As Range
Dim i As Long

Set RefDoc = ActiveDocument
Set ChangeDoc = Documents.Open("D:\My Documents\Test\changes.doc")
Set cTable = ChangeDoc.Tables(1)
RefDoc.Activate
For i = 1 To cTable.Rows.Count
Set oldPart = cTable.Cell(i, 1).Range
oldPart.End = oldPart.End - 1
Set newPart = cTable.Cell(i, 2).Range
newPart.End = newPart.End - 1
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Execute findText:=oldPart, _
ReplaceWith:=newPart, _
replace:=wdReplaceAll, _
MatchWildcards:=False, _
Forward:=True, _
Wrap:=wdFindContinue
End With
End With
Next i
ChangeDoc.Close wdDoNotSaveChanges
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



EKH wrote:
When searching for text in a document, the Find and Replace command
fails after being used repeatedly to find a large number (50 or more)
of phrases. I have not noticed this problem in previous versions of
Word. Any ideas as to why this happens?




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 45
Default Word 2007 Find and Replace Command fails

Hi EKH,


When searching for text in a document, the Find and Replace command fails
after being used repeatedly to find a large number (50 or more) of phrases.
I have not noticed this problem in previous versions of Word. Any ideas as
to why this happens?


maybe:
http://word.mvps.org/FAQs/MacrosVBA/FlushFR.htm

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
EKH EKH is offline
external usenet poster
 
Posts: 15
Default Word 2007 Find and Replace Command fails

Thanks!

"Helmut Weber" wrote:

Hi EKH,


When searching for text in a document, the Find and Replace command fails
after being used repeatedly to find a large number (50 or more) of phrases.
I have not noticed this problem in previous versions of Word. Any ideas as
to why this happens?


maybe:
http://word.mvps.org/FAQs/MacrosVBA/FlushFR.htm

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Word 2007 Find and Replace Crashclh Microsoft Word Help 4 October 15th 07 02:28 PM
Word 2007 Find and Replace Island Girl New Users 4 March 29th 07 06:54 AM
Spell Check on Word /Excel/Outlook 2007 fails to find any errors Marq Hills Microsoft Word Help 1 March 7th 07 08:57 PM
Find and replace in Word 2007 Ira Finkelstein Microsoft Word Help 3 June 6th 06 07:16 AM
Replace command in Word doesn't find word or text selected. Zogger Microsoft Word Help 3 November 15th 05 09:57 PM


All times are GMT +1. The time now is 09:42 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"