Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2019, 03:09 PM
Genericname1111 Genericname1111 is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 7 64bit Find/replace - symbol for all numbers or symbol letters (Word 97) Office 97-2003
Novice
Find/replace - symbol for all numbers or symbol letters (Word 97)
 
Join Date: Aug 2019
Posts: 17
Genericname1111 is on a distinguished road
Default Find/replace - symbol for all numbers or symbol letters (Word 97)


Hi,
For a find/replace macro, is there any character that represents all numbers, so that when I run the macro it finds all number instances and doesn't replace the numbers? I want the numbers to stay the same, but I want to replace parts around the numbers, and it'd be very time-consuming to keep making new copies of code to add each number.
e.g.
page 1 -> page(non-breaking space)2
page 2 -> page(non-breaking space)3
page 3 -> page(non-breaking space)3
etc.
paragraph 1 -> page(non-breaking space)2

But there are lots of different words like that that I want to do it for, so without an all numbers character I'd have to do 10 versions of each macro which would take ages.
Also, is there a symbol for all letters?
I know there are symbols for all numbers and all letters within the find/replace box (e.g. ^$), but they don't seem to work for find/replace which makes me wonder if this is even possible in word 97.

Thanks.

Last edited by Charles Kenyon; 11-11-2019 at 05:45 AM. Reason: Removed 'macro' from title
Reply With Quote
  #2  
Old 10-06-2019, 09:01 PM
gmayor's Avatar
gmayor gmayor is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 10 Find/replace - symbol for all numbers or symbol letters (Word 97) Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Search for ^#
Replace with
Text before number ^& text after number

^$ finds any letter as you suggest.
See also Replace using wildcards
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #3  
Old 10-07-2019, 06:22 PM
Genericname1111 Genericname1111 is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 7 64bit Find/replace - symbol for all numbers or symbol letters (Word 97) Office 97-2003
Novice
Find/replace - symbol for all numbers or symbol letters (Word 97)
 
Join Date: Aug 2019
Posts: 17
Genericname1111 is on a distinguished road
Default

Thank you! That works well. For ^$, it tells me that ^$ is not a valid character for the replace box, any ideas how I can get around that?
Reply With Quote
  #4  
Old 10-07-2019, 06:52 PM
Charles Kenyon Charles Kenyon is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 10 Find/replace - symbol for all numbers or symbol letters (Word 97) Office 2016
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Re-read Graham's answer.

You want ^& in the replace box. That is the symbol for whatever was found.
Reply With Quote
  #5  
Old 10-10-2019, 04:17 PM
Genericname1111 Genericname1111 is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 7 64bit Find/replace - symbol for all numbers or symbol letters (Word 97) Office 97-2003
Novice
Find/replace - symbol for all numbers or symbol letters (Word 97)
 
Join Date: Aug 2019
Posts: 17
Genericname1111 is on a distinguished road
Default

I tried a find/replace:
e.g.
find: page_^#
Replace: page_^&
It adds another "page" word in front, I guess because ^& found the word "page" in the "find" field. Am I doing it wrong?

I also tried replacing "^$ ^$" with "^$ ^$" with the aim of removing all double spaces between words (but not between full stops and words), but when I do that it tells me that that ^$ is not a valid character for find/replace.
Reply With Quote
  #6  
Old 10-11-2019, 10:52 AM
Charles Kenyon Charles Kenyon is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 10 Find/replace - symbol for all numbers or symbol letters (Word 97) Office 2016
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by Genericname1111 View Post
I tried a find/replace:
e.g.
find: page_^#
Replace: page_^&
It adds another "page" word in front, I guess because ^& found the word "page" in the "find" field. Am I doing it wrong?

***

Yes, the word "page" is in your found text.
Replace: ^&


Are you searching for a page number field?
Reply With Quote
  #7  
Old 10-11-2019, 10:59 AM
Charles Kenyon Charles Kenyon is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 10 Find/replace - symbol for all numbers or symbol letters (Word 97) Office 2016
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by Genericname1111 View Post
Hi,
For a find/replace macro, ***
I was going to moderate the word "macro" out of the title for this thread but was not sure.
Are you really looking for a macro? I am reading your question as you simply want a solution to be able to do the replace.

As you've seen, the general replace function is very powerful.

Once you have replace settings that do what you want, you can record a macro if you need one.
Reply With Quote
  #8  
Old 10-11-2019, 05:42 PM
Genericname1111 Genericname1111 is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 7 64bit Find/replace - symbol for all numbers or symbol letters (Word 97) Office 97-2003
Novice
Find/replace - symbol for all numbers or symbol letters (Word 97)
 
Join Date: Aug 2019
Posts: 17
Genericname1111 is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
Yes, the word "page" is in your found text.
Replace: ^&


Are you searching for a page number field?
Oops I stuffed up the text there - it should have been:

Find: Page ^#
Replace: Page_^&

Basically with my transcription work we have to add non-breaking spaces after most numbers, but for some numbers (like numbers after the words unit, paragraph, etc.) the non-breaking space goes between the word and the number, not afterwards. I often forget to add them so I'm trying to do find/replaces to find those specific words and add the non-breaking spaces between those words and numbers. But creating 10 sections in a macro for each word + number combination (e.g. page 0-9 / unit 0-9) is time-consuming.
Quote:
Originally Posted by Charles Kenyon View Post
I was going to moderate the word "macro" out of the title for this thread but was not sure.
Are you really looking for a macro? I am reading your question as you simply want a solution to be able to do the replace.

As you've seen, the general replace function is very powerful.

Once you have replace settings that do what you want, you can record a macro if you need one.
Yes that's a good point, I am going to make a macro but really I'm just trying to figure out how to do it in find/replace and then I'll just turn it into a macro.
Reply With Quote
  #9  
Old 10-12-2019, 12:58 PM
Charles Kenyon Charles Kenyon is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 10 Find/replace - symbol for all numbers or symbol letters (Word 97) Office 2016
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,081
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I am confident that what you want can be done in a single replace.


However, I would start with a replace of:
Find text: "Page "
Replace text: "Page_"

Then a second replace:
Find Text: "Page_^#"
Replace Text: "^&"

(all without the quotation marks)
Reply With Quote
  #10  
Old 11-10-2019, 04:22 PM
Genericname1111 Genericname1111 is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 7 64bit Find/replace - symbol for all numbers or symbol letters (Word 97) Office 97-2003
Novice
Find/replace - symbol for all numbers or symbol letters (Word 97)
 
Join Date: Aug 2019
Posts: 17
Genericname1111 is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
I am confident that what you want can be done in a single replace.


However, I would start with a replace of:
Find text: "Page "
Replace text: "Page_"

Then a second replace:
Find Text: "Page_^#"
Replace Text: "^&"

(all without the quotation marks)
Thank you. Trying this, the problem I encounter here is that because I'm using a non-breaking space (the underscore was just an example for my post), I only want the non-breaking spaces between e.g. the word "page" and a number that comes afterwards, but not when there's a word after "page". So that method works to replace all instances where it's "page 1", "page 2", etc., but then it also adds non-breaking spaces after all instances of page, and I can't then remove them easily for those instances where there's a word after page, because ^$ isn't a valid character for the replace box.

So basically I want (as examples):
Before: page 1 -> page_1
Before: page 20 -> page_20
But not:
page of -> page_of
page that -> page_that

But i'm not sure how to achieve that easily.
Reply With Quote
  #11  
Old 11-10-2019, 10:37 PM
gmayor's Avatar
gmayor gmayor is offline Find/replace - symbol for all numbers or symbol letters (Word 97) Windows 10 Find/replace - symbol for all numbers or symbol letters (Word 97) Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

You need a wildcard search for that - search for

(page) ([0-9]{1,})

or if 'page' may also include 'Page', search for

([pP]{1}age) ([0-9]{1,})

Replace either with

\1^0160\2

Replace using wildcards
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace Numbers Macro VBA in Microsoft Word Yotem189 Word VBA 3 09-20-2018 05:55 AM
Find/replace - symbol for all numbers or symbol letters (Word 97) Foot symbol/inches symbol Mr. P Word 1 09-05-2016 11:55 AM
Find/replace - symbol for all numbers or symbol letters (Word 97) A macro to find a symbol, delete it, and move the cursor to that location JayBird24 Word VBA 1 08-19-2016 04:26 PM
Find/replace - symbol for all numbers or symbol letters (Word 97) Make my own image and save as symbol in the symbol chart DeniseN Office 1 03-20-2015 01:13 AM
Find/replace - symbol for all numbers or symbol letters (Word 97) how to find and replace a symbol with another symbol wondermuse Word 5 10-09-2014 06:30 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:15 AM.


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