Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Hi
I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Try
MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Thanks Greg
I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Did you set the format in the find field to "Bold."
It should work if I understand your objective. Find words in bold and delete first five characters. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Thanks Greg I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Yes I did as you mentioned.
Even though if I did not change the Find field to bold it should have deleted the first five characters of words with normal format? "Greg Maxey" wrote: Did you set the format in the find field to "Bold." It should work if I understand your objective. Find words in bold and delete first five characters. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Thanks Greg I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Julian,
Hmm,,try Find: *{4}(*) Replace: \1 If this doesn't work, show me an example of what should be found and what it should look like afterwards. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Yes I did as you mentioned. Even though if I did not change the Find field to bold it should have deleted the first five characters of words with normal format? "Greg Maxey" wrote: Did you set the format in the find field to "Bold." It should work if I understand your objective. Find words in bold and delete first five characters. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Thanks Greg I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Hi
Example 1 Word without format Word befo stronger Word after: er Example2 A whole line with bold format Line befo My name is Julian Line after: me is Julian Is the expression *{4}(*) going to mark the first 4 characters in every word in the text even when you use the expression just for searching words? "Greg Maxey" wrote: Julian, Hmm,,try Find: *{4}(*) Replace: \1 If this doesn't work, show me an example of what should be found and what it should look like afterwards. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Yes I did as you mentioned. Even though if I did not change the Find field to bold it should have deleted the first five characters of words with normal format? "Greg Maxey" wrote: Did you set the format in the find field to "Bold." It should work if I understand your objective. Find words in bold and delete first five characters. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Thanks Greg I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Julian,
You are changing the rules in the middle of the game ;-) You said nothing about whole lines in your original post or about changing non-bolded text. The last code I sent you would convert Stronger stronger stronger stronger to: "stronger er stronger er" if the second and fouth words where formatted to bold. If you want the "find" isolated to "bold" text only, then you have to put the cursor in the find field and press Moreformatfontbold. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi Example 1 Word without format Word befo stronger Word after: er Example2 A whole line with bold format Line befo My name is Julian Line after: me is Julian Is the expression *{4}(*) going to mark the first 4 characters in every word in the text even when you use the expression just for searching words? "Greg Maxey" wrote: Julian, Hmm,,try Find: *{4}(*) Replace: \1 If this doesn't work, show me an example of what should be found and what it should look like afterwards. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Yes I did as you mentioned. Even though if I did not change the Find field to bold it should have deleted the first five characters of words with normal format? "Greg Maxey" wrote: Did you set the format in the find field to "Bold." It should work if I understand your objective. Find words in bold and delete first five characters. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Thanks Greg I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Hi Greg
I will tell you the whole story now. I have a big document which has several heading levels Heading1, Heading2, Heading3 The Headings are numbered manually which means that if you add or delete a heading the correct heading number will not be updated. What I want to do is to delete all the manually added numbers in the beginning of each heading and add automatic numbering format. The only problem is how to delete the numbers which each heading starts with. Example1 heading3 befo 1.2.2 Technical specification heading3 after: Technical specification "Greg Maxey" wrote: Julian, You are changing the rules in the middle of the game ;-) You said nothing about whole lines in your original post or about changing non-bolded text. The last code I sent you would convert Stronger stronger stronger stronger to: "stronger er stronger er" if the second and fouth words where formatted to bold. If you want the "find" isolated to "bold" text only, then you have to put the cursor in the find field and press Moreformatfontbold. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi Example 1 Word without format Word befo stronger Word after: er Example2 A whole line with bold format Line befo My name is Julian Line after: me is Julian Is the expression *{4}(*) going to mark the first 4 characters in every word in the text even when you use the expression just for searching words? "Greg Maxey" wrote: Julian, Hmm,,try Find: *{4}(*) Replace: \1 If this doesn't work, show me an example of what should be found and what it should look like afterwards. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Yes I did as you mentioned. Even though if I did not change the Find field to bold it should have deleted the first five characters of words with normal format? "Greg Maxey" wrote: Did you set the format in the find field to "Bold." It should work if I understand your objective. Find words in bold and delete first five characters. -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Thanks Greg I did as you mentioned but it did not work. I tried to search ?{5}(*) and replace it with \1 "Greg Maxey" wrote: Try MoreUse Wildcards Find: ?{5}(*) Replace with \1 -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Julian wrote: Hi I am trying to find words with bold format and delete the substring [0,5] of all occurences All words are longer then 5 letters. I am able to find the words with the format but I cannot delete the substing. Is it possible to type something like [6]* in the replace field to keep the letter 6 and higher in the word? Any suggestions? |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Replace/Erase substring of a word
Try this ;-)
Sub Test() Dim oPar As Paragraph Dim myRng As Range For Each oPar In ActiveDocument.Paragraphs Select Case oPar.Style Case "Heading 1", "Heading 2", "Heading 3" Set myRng = oPar.Range.Duplicate myRng.Collapse wdCollapseStart myRng.MoveEndUntil Cset:="ABCDEFGHIJKLMNOPQRSTUVWXYZ" myRng.MoveEnd wdCharacter, -1 myRng.Delete Case Else 'Do Nothing End Select Next oPar End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Fill-in field prompts | New Users | |||
WP merge file to Word | Tables | |||
How can Word display full path of a file in the title bar? | Microsoft Word Help | |||
Does Word have a QuickCorrect/Quick Word option like WordPerfect? | New Users | |||
In Word, how do I surpress headers and footers on page 2 | Microsoft Word Help |