Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 11-27-2024, 02:01 AM
Shelley Lou Shelley Lou is offline VBA Swap text around Windows 10 VBA Swap text around Office 2016
Expert
VBA Swap text around
 
Join Date: Dec 2020
Posts: 259
Shelley Lou is on a distinguished road
Default VBA Swap text around

Hi Macropod, thank you so much for providing the find and replace. I've put it into a little macro but for some reason it will only work if the text and number are separated by non breaking spaces and doesn't work if its just separated with a space - what do I need to add to include both space and non breaking space? Thanks

Code:
Sub SwapText_SchedulePart()
Dim oRng As Range
Set oRng = ActiveDocument.Range
With oRng.Find
  .ClearFormatting
  .Forward = True
  .Wrap = wdFindStop
  .Format = True
  .MatchCase = False
  .MatchWildcards = True
  .text = "([Ss]chedule*)[, ]@([Pp]art*)([ ;.,])"
  .Replacement.text = "\2 of \1\3"
  .Execute Replace:=wdReplaceAll
End With
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I swap managers and subordinates in org chart weety Visio 0 05-23-2024 08:50 AM
swap values s7y Excel Programming 0 05-15-2012 01:32 PM
VBA Swap text around macro to swap between letterhead anno1404 Word VBA 7 03-31-2012 02:33 PM
How do I swap slides during a presentation? Harper PowerPoint 0 08-17-2011 09:13 AM
VBA Swap text around Swap file office1983 Outlook 1 02-15-2011 07:11 AM

Other Forums: Access Forums

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