Reply
 
Thread Tools Display Modes
  #1   Report Post  
Steved
 
Posts: n/a
Default To run threw the whole document

Hello from Steved

Please how do I get the below macro to run through the
whole Document.

Thankyou.

Dim s As String
Dim p As Integer
Selection.Paragraphs(1).Range.Select
s = Selection.Text
p = InStr(1, s, " ")
p = InStr(p + 1, s, " ")
s = Right(s, Len(s) - p)
Selection.Paragraphs(1).Range.Text = s
  #2   Report Post  
Jezebel
 
Posts: n/a
Default

Find and replace will do this. With 'Use wildcards' checked --

Find: [! ]@ [! ]@ ([!^013]@[^013])
Replace with: \1



If you really want to do it with code --

Dim pPar as Word.Paragraph
Dim s as string
Dim p as long (Don't use Integers in VB/VBA)

For each pPar in ActiveDocument.Paragraphs

s = pPar..Range.Text
p = InStr(1, s, " ")
If p 0 then
p = InStr(p + 1, s, " ")
If p 0 then
pPar.Range.Text = Mid$(s, p+1)
End if
End if

Next




"Steved" wrote in message
...
Hello from Steved

Please how do I get the below macro to run through the
whole Document.

Thankyou.

Dim s As String
Dim p As Integer
Selection.Paragraphs(1).Range.Select
s = Selection.Text
p = InStr(1, s, " ")
p = InStr(p + 1, s, " ")
s = Right(s, Len(s) - p)
Selection.Paragraphs(1).Range.Text = s



  #3   Report Post  
Steved
 
Posts: n/a
Default

Thankyou.
-----Original Message-----
Find and replace will do this. With 'Use wildcards'

checked --

Find: [! ]@ [! ]@ ([!^013]@[^013])
Replace with: \1



If you really want to do it with code --

Dim pPar as Word.Paragraph
Dim s as string
Dim p as long (Don't use Integers in VB/VBA)

For each pPar in ActiveDocument.Paragraphs

s = pPar..Range.Text
p = InStr(1, s, " ")
If p 0 then
p = InStr(p + 1, s, " ")
If p 0 then
pPar.Range.Text = Mid$(s, p+1)
End if
End if

Next




"Steved" wrote in

message
...
Hello from Steved

Please how do I get the below macro to run through the
whole Document.

Thankyou.

Dim s As String
Dim p As Integer
Selection.Paragraphs(1).Range.Select
s = Selection.Text
p = InStr(1, s, " ")
p = InStr(p + 1, s, " ")
s = Right(s, Len(s) - p)
Selection.Paragraphs(1).Range.Text = s



.

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
Opening a document in a protected form CheeryNan Microsoft Word Help 5 August 1st 22 07:34 AM
Can you save individual document pages as seperate word files? John Calligy Mailmerge 2 April 12th 05 09:14 AM
Document out of focus Cor van der Bliek Microsoft Word Help 8 February 8th 05 08:29 AM
Newbie document question please Dudley Henriques New Users 4 January 9th 05 08:38 PM
Document object in protected form Bruce Tables 2 December 6th 04 07:09 PM


All times are GMT +1. The time now is 06:46 PM.

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"