Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Opening a document in a protected form | Microsoft Word Help | |||
Can you save individual document pages as seperate word files? | Mailmerge | |||
Document out of focus | Microsoft Word Help | |||
Newbie document question please | New Users | |||
Document object in protected form | Tables |