Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 06-09-2011, 01:17 AM
macropod's Avatar
macropod macropod is offline Indexing Macro Windows 7 32bit Indexing Macro Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Hi mtames1,

Perhaps you could explain what you're trying to achieve with the various kinds of tags. It appears you want to keep all except the '<$I[cat]' and '>' of some, but only a lesser portion of others. If all the tags are all in the format you've described, a single wildcard Find can locate them all. For example:
Find = \<$I\[cat\]([!\>]{1,})\>
Replace = \1

Also, your code has a lot of redundacy in it - there is no need to keep setting the Find/Replace parameters. For example:
Code:
...
Dim myField As Field
With Selection.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Forward = True
  .Wrap = wdFindStop
  .Format = True
  .MatchCase = False
  .MatchWholeWord = False
  .MatchAllWordForms = False
  .MatchSoundsLike = False
  .MatchWildcards = False
  .Text = "><"
  .Replacement.Text = "> */-/* <"
  .Execute Replace:=wdReplaceAll
  .Replacement.Style = ActiveDocument.Styles("Big Yellow")
  .Text = "[\<]$I\[cat\]([0-9A-Za-z,\-\(\) ]{1,})\[([0-9A-Za-z,\-\(\) ]{1,})\][\>]"
  .Replacement.Text = " \1"
  .Execute Replace:=wdReplaceAll
  .Text = "[\<]$I)[cat\]([0-9A-Za-z,\-\(\) ]{1,})\[([0-9A-Za-z,\-\(\) ]{1,})\];([0-9A-Za-z,\-\(\) ]{1,})\[([0-9A-Za-z,\-\(\) ]{1,})\][\>]"
  .Replacement.Text = " \1:\3"
  .Execute Replace:=wdReplaceAll
End With
myCharStyle = "Big Yellow"
...
PS: When posting code, please use code tags and formatted code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Indexing Macro Instant search not functional because of continuing "indexing" arrigo Outlook 1 12-07-2010 09:13 PM
Indexing in document rafikul Word 0 12-17-2009 11:07 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:28 PM.


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