Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-03-2015, 01:13 AM
norgro norgro is offline Replace ^u with the word "under" Windows XP Replace ^u with the word "under" Office 2007
Novice
Replace ^u with the word "under"
 
Join Date: Feb 2013
Location: Perh Australia
Posts: 12
norgro is on a distinguished road
Default Replace ^u with the word "under"

When Duxbury Braille code is copied into MS Word, the code for the word "under" is "^u".

I want to replace the symbol "^u" with the word under.

I have tried the following code, without success.

Sub Replace_BrailleCodeSymbol_with_word()
'Replace the Braille symbol "^u" with the word "under"
Dim oRng As Range


Dim oWord As Range
Set oRng = ActiveDocument.Range
With oRng.Find
' Do While .Execute(FindText:=Chr(94) & "u")
Do While .Execute(FindText:="^u")
Set oWord = oRng.Words(1)
oRng.Text = "under"
oRng.Collapse 0
Loop
End With
lbl_Exit:
Set oRng = Nothing
Set oWord = Nothing
Exit Sub
End Sub

Your help would be appreciated.

Norman
Reply With Quote
  #2  
Old 08-03-2015, 08:36 PM
macropod's Avatar
macropod macropod is offline Replace ^u with the word "under" Windows 7 64bit Replace ^u with the word "under" Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

Try:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^^u"
    .Replacement.Text = "under"
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
  End With
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 08-03-2015, 08:46 PM
norgro norgro is offline Replace ^u with the word "under" Windows XP Replace ^u with the word "under" Office 2007
Novice
Replace ^u with the word "under"
 
Join Date: Feb 2013
Location: Perh Australia
Posts: 12
norgro is on a distinguished road
Default

Thanks Paul, I have successfully tried your method. I appreciate your help. What a great forum this is! Norman
Reply With Quote
  #4  
Old 08-03-2015, 08:54 PM
macropod's Avatar
macropod macropod is offline Replace ^u with the word "under" Windows 7 64bit Replace ^u with the word "under" Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

When using Find for strings beginning with ^, you need to input the ^ twice. That's because ^ on its own functions as an escape character.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I delete the names under "Exceptions" when I use the "Restrict Editing" feature in Word? MengS Word 0 02-25-2015 02:57 PM
"Replace all" within a selection (Word 2007) paulkaye Word 5 02-19-2013 01:25 AM
'Linking' entered information to other "cells" from an original "cell" in MS Word Wade Word 6 09-03-2012 05:22 PM
Replace ^u with the word "under" replace data from variable with "sub and super script" from excel to word by vba krishnaoptif Word VBA 9 06-22-2012 05:08 AM
Replace ^u with the word "under" How to "replace" a word with same word but "Italic"? Jamal NUMAN Word 4 07-08-2011 04:02 AM

Other Forums: Access Forums

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


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft