Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 09-29-2023, 09:30 AM
vivka vivka is offline Replace dashes between two digits without using Selection Windows 7 64bit Replace dashes between two digits without using Selection Office 2016
Expert
 
Join Date: Jul 2023
Posts: 293
vivka is on a distinguished road
Default

Hi, RobiNew! If undersatand correctly what you want, try the following. But note that m-dash has code 151 and n-dash has code 150.
Code:
Sub DASHES()
'Testo e Note: Sostituisce m-dash con n-dash

Dim mStory As range 'Nel testo e nelle note
Dim mRange As range
  For Each mStory In ActiveDocument.StoryRanges
    mStory.Find.Execute FindText:="([0-9])" & Chr(151) & "([0-9])", _
    ReplaceWith:="\1" & Chr(150) & "\2", _
    MatchWildcards:=True, _
    Replace:=wdReplaceAll
  Next mStory
End SUb
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
find and replace only in current selection Bikram Word VBA 4 11-12-2021 07:31 AM
Find and replace numbers (up to three digits) ballpoint Word 3 06-13-2018 08:58 AM
Replace dashes between two digits without using Selection Search+replace all --- [3 dashes] with square wingding imported_contiw Word 14 10-04-2017 01:03 PM
Macro to replace digits with letters Bananabean Word VBA 6 09-14-2013 09:28 PM
Replace dashes between two digits without using Selection Problems merging in last 4 digits of an account higher than 16 digits Glynda Mail Merge 1 04-08-2011 12:17 AM

Other Forums: Access Forums

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