Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Find first Word but ignore if it is x
Hello from Steved
I am building a macro to find the first Word Please how do I write the macro to ignore the letter x 2. 111x9 Our Front Line 3. x6028 Aqua Meadow 3. 15x73 La Strada From the above and after writing the macro it should return the below Our Front Line Aqua Meadow La Strada Thankyou and Season Grettings to you all. |
#2
|
|||
|
|||
G'day "Steved" ,
For each aWord in aParagraph.Words if instr(1,aWord.text,"x") then 'bad word else 'good word end if next But really, I think you should be testing for the presence of numerics :-) Steve Hudson - Word Heretic steve from wordheretic.com (Email replies require payment) Without prejudice Steved reckoned: Hello from Steved I am building a macro to find the first Word Please how do I write the macro to ignore the letter x 2. 111x9 Our Front Line 3. x6028 Aqua Meadow 3. 15x73 La Strada From the above and after writing the macro it should return the below Our Front Line Aqua Meadow La Strada Thankyou and Season Grettings to you all. |
#3
|
|||
|
|||
Thankyou.
-----Original Message----- G'day "Steved" , For each aWord in aParagraph.Words if instr(1,aWord.text,"x") then 'bad word else 'good word end if next But really, I think you should be testing for the presence of numerics :-) Steve Hudson - Word Heretic steve from wordheretic.com (Email replies require payment) Without prejudice Steved reckoned: Hello from Steved I am building a macro to find the first Word Please how do I write the macro to ignore the letter x 2. 111x9 Our Front Line 3. x6028 Aqua Meadow 3. 15x73 La Strada From the above and after writing the macro it should return the below Our Front Line Aqua Meadow La Strada Thankyou and Season Grettings to you all. . |
#4
|
|||
|
|||
Hello from Steved
You kindly suguested that I test for numerics Would you please write a macro that would find the first word and delete the numerics Thankyou. -----Original Message----- G'day "Steved" , For each aWord in aParagraph.Words if instr(1,aWord.text,"x") then 'bad word else 'good word end if next But really, I think you should be testing for the presence of numerics :-) Steve Hudson - Word Heretic steve from wordheretic.com (Email replies require payment) Without prejudice Steved reckoned: Hello from Steved I am building a macro to find the first Word Please how do I write the macro to ignore the letter x 2. 111x9 Our Front Line 3. x6028 Aqua Meadow 3. 15x73 La Strada From the above and after writing the macro it should return the below Our Front Line Aqua Meadow La Strada Thankyou and Season Grettings to you all. . |
#5
|
|||
|
|||
Hi Steved,
I think what you want to do is to cut off the leftmost text in the paragraph (if is is a paragraph) including the second space. Like this, which could be much shorter, but might be more difficult to understand then for a beginner. Put the cursor in one of the paragraphs in question. Dim s As String Dim p As Integer Selection.Paragraphs(1).Range.Select s = Selection.Text p = InStr(1, s, " ") ' position of 1st space p = InStr(p + 1, s, " ") ' position of 2nd space s = Right(s, Len(s) - p) ' text right of position Selection.Paragraphs(1).Range.Text = s You may change it to your needs, like processing all paragraphs in a doc or all paragraphs in the selection or whatever. Greetings from Bavaria, Germany Helmut Weber, MVP "red.sys" & chr(64) & "t-online.de" Word XP, Win 98 http://word.mvps.org/ |
#6
|
|||
|
|||
Thankyou
Yes I am a beginner in word but I can follow what you have given me. -----Original Message----- Hi Steved, I think what you want to do is to cut off the leftmost text in the paragraph (if is is a paragraph) including the second space. Like this, which could be much shorter, but might be more difficult to understand then for a beginner. Put the cursor in one of the paragraphs in question. Dim s As String Dim p As Integer Selection.Paragraphs(1).Range.Select s = Selection.Text p = InStr(1, s, " ") ' position of 1st space p = InStr(p + 1, s, " ") ' position of 2nd space s = Right(s, Len(s) - p) ' text right of position Selection.Paragraphs(1).Range.Text = s You may change it to your needs, like processing all paragraphs in a doc or all paragraphs in the selection or whatever. Greetings from Bavaria, Germany Helmut Weber, MVP "red.sys" & chr(64) & "t-online.de" Word XP, Win 98 http://word.mvps.org/ . |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I divide a page into three sections? | Microsoft Word Help | |||
Feature Found in Word 97 that I can't find in Word 2002 | Microsoft Word Help | |||
saving the workspace | Microsoft Word Help | |||
where can I find an Adobe conversion plugin for Word 2003 for XP? | Microsoft Word Help | |||
Word 2000 hyperlinks can't find Internet connection | Microsoft Word Help |