Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #14  
Old 03-10-2013, 02:56 PM
macropod's Avatar
macropod macropod is offline Text manipulation in MACRO Windows 7 64bit Text manipulation in MACRO Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,384
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

You're still working with selections, though - your next meaningful step is:
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Quote:
And I need to run this Macro only once.
It seems to me that writing the macro would've taken much longer than doing the job manually. Unless you need to do this on multiple documents, there'd be a negative ROI.

That said, you can still do it with Find/Replace, by deleting the 'CTR', though typing the expression each time might be tedious - as well as being error-prone. As a macro, the F/R becomes:
Code:
Sub Demo()
With Selection
  .HomeKey Unit:=wdStory
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "([!^13]@^13)(*^13)([!^13]^13)([!^13]@^13)[!^13]@^13([!^13]@^13)"
    .Replacement.Text = "AN \1AC \3AH \4AL \5\2"
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchWildcards = True
    .Execute Replace:=wdReplaceOne
  End With
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Text manipulation in MACRO Macro to find text and replace with form field containing that text iiiiifffff Word VBA 16 06-04-2016 01:47 AM
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
Text manipulation in MACRO Need help on Macro 03- Find text - if text is blank then remove line simpleonline1234 Word VBA 1 02-25-2011 02:28 AM
Text manipulation in MACRO Combobox manipulation vsempoux Word VBA 3 10-31-2009 08:58 AM
Mail merge Field Code Manipulation macjnr Mail Merge 0 09-10-2009 11:37 AM

Other Forums: Access Forums

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