Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 12-09-2018, 11:26 PM
Guessed's Avatar
Guessed Guessed is offline Need to repeat macro for multiple times Windows 10 Need to repeat macro for multiple times Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I also think we need to see the context and reason for what you are trying to achieve. Looking at your code, it appears like it might be rewritten to loop along the following lines.
Code:
Sub get_irf_fnf()
  Dim s1 As String, s2 As String
  s1 = "(\<irf fnf=)(" & ChrW(8220) & "[A-Z 0-9]{1,}" & ChrW(8221) & "/\>)(*)^13"
  s2 = "(\<irf fnfr=)(" & ChrW(8220) & "[A-Z 0-9]{1,}" & ChrW(8221) & "/\>)-(\<)irf fnf=(" & ChrW(8220) & "[A-Z 0-9]{1,}" & ChrW(8221) & "/\>)"
  
  Selection.HomeKey Unit:=wdStory
  With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = s1
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    Do While .Execute = True
      Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
      Selection.Cut
      Selection.HomeKey Unit:=wdStory
      .Text = s2
      .Execute
      Selection.PasteAndFormat (wdFormatOriginalFormatting)
      Selection.HomeKey Unit:=wdStory
      .Text = s1
    Loop
  End With
End Sub
We would need to see a sample document to figure out whether that code would be workable.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to repeat macro for multiple times Mail Merge Repeat Record a certain number of times stacey_e Mail Merge 7 07-07-2023 01:27 AM
Repeat macro until no more fields ChrisJ83 Word VBA 2 01-20-2016 04:55 AM
Need to repeat macro for multiple times Print Format - Repeat Text From a Cell on Multiple Pages ChristopherHughes Excel 1 12-07-2014 08:31 PM
Need to repeat macro for multiple times How to repeat multiple .jpg's over again in Custom Slide show pbyrescue PowerPoint 1 04-03-2014 12:40 PM
Repeat formula 5 times and repeat? Jenny345 Excel 4 06-14-2013 04:37 PM

Other Forums: Access Forums

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