Reply
 
Thread Tools Display Modes
  #1   Report Post  
Steved
 
Posts: n/a
Default 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   Report Post  
Word Heretic
 
Posts: n/a
Default

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   Report Post  
Steved
 
Posts: n/a
Default

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   Report Post  
Steved
 
Posts: n/a
Default

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   Report Post  
Helmut Weber
 
Posts: n/a
Default

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   Report Post  
Steved
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I divide a page into three sections? Bonnie Microsoft Word Help 3 May 8th 23 02:47 AM
Feature Found in Word 97 that I can't find in Word 2002 sandrzep Microsoft Word Help 1 December 16th 04 07:21 PM
saving the workspace Mike Microsoft Word Help 3 December 8th 04 11:32 PM
where can I find an Adobe conversion plugin for Word 2003 for XP? pegl Microsoft Word Help 2 December 2nd 04 08:29 PM
Word 2000 hyperlinks can't find Internet connection Yona Microsoft Word Help 1 November 28th 04 01:19 AM


All times are GMT +1. The time now is 09:14 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"