Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-05-2012, 07:36 AM
vthomeschoolmom vthomeschoolmom is offline Macro for replacing, copying and undoing. Windows 7 32bit Macro for replacing, copying and undoing. Office 2010 32bit
Novice
Macro for replacing, copying and undoing.
 
Join Date: Feb 2012
Posts: 23
vthomeschoolmom is on a distinguished road
Default Macro for replacing, copying and undoing.

I use MS Word to basically work around a bunch of limitations in another piece of garbage application my company uses. I write macros to speed things I need to do. One macro I have is:

Code:
Sub ConvertSelectedNumberstoText()
'
' ConvertSelectedNumberstoText Macro
'
'
ActiveDocument.ConvertNumbersToText
With Selection.Find
  .Text = "^t"
  .Replacement.Text = " "
  .Forward = True
  .Wrap = wdFindAsk
  .Format = False
  .MatchCase = False
  .MatchWholeWord = False
  .MatchWildcards = False
  .MatchSoundsLike = False
  .MatchAllWordForms = False
  .Execute Replace:=wdReplaceAll
End With
Selection.Copy
ActiveDocument.Undo
End Sub
At the line in bold red above, Word prompts me with Word has reached the end of the document. x replacements were made. Do you want to continue searching at the beginning. I click no.

The text in my document that was previously copied is no longer selected, so the remainder of the macro does nothing useful. I think the copy line errors with a nothing is selected error.

What I want to know is if it is possible to perform the execute silently not continuing the search. I want it to leave my selection alone so that the remainder of the macro will complete.



Anyone have ideas? I see nothing obvious in the Execute method help.

Thanks

Last edited by macropod; 12-05-2012 at 03:38 PM. Reason: Added code tags & formatting
Reply With Quote
  #2  
Old 12-05-2012, 07:41 AM
vthomeschoolmom vthomeschoolmom is offline Macro for replacing, copying and undoing. Windows 7 32bit Macro for replacing, copying and undoing. Office 2010 32bit
Novice
Macro for replacing, copying and undoing.
 
Join Date: Feb 2012
Posts: 23
vthomeschoolmom is on a distinguished road
Default

DOH!

,Wrap = wdFindContinue

I do actually want it to continue... I often find answers myself the second I post to a forum. Silly me.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for replacing, copying and undoing. Replacing horizontal lines eosrose Word VBA 2 06-16-2023 11:58 PM
Macro for replacing, copying and undoing. Help with replacing text with wildcards sbatson5 Word 2 04-13-2012 03:49 AM
Macro for replacing, copying and undoing. Word replacing problem!!!! Jamal NUMAN Word 2 07-08-2011 03:56 AM
Macro for replacing, copying and undoing. Replacing default fonts mark98101 Word 1 01-31-2011 02:31 PM
Replacing / editting text LisaC Word 0 02-25-2010 03:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:25 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