Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

Copy Paste Special Challenge

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mr M Walker - 26 Jul 2005 15:20 GMT
Is it possible to copy a word document page but leave the first 3 space
behind on every line for the whole document I need to do this for over 3000
pages so do not want to by line by line I am trying to achieve:

001 dsfdsfsd
002 sdfdsfsdf
003 sdfdsfsdf

to becomes

dsfdsfsd
sdfdsfsdf
sdfdsfsdf

is this possible

Many thanks

Marcus

Marcus
Chuck Henrich - 26 Jul 2005 16:09 GMT
How's this - it goes through each paragraph (assuming each line is actually a
paragraph) and strips off the first 4 chars):

Dim x As Long
Dim strString As String

With ActiveDocument
   For x = 1 To .Paragraphs.Count
       strString = .Paragraphs(x).Range.Text
       strString = Right(strString, Len(strString) - 4)
       .Paragraphs(x).Range.Text = strString
   Next x
End With

HTH
Signature

Chuck Henrich
www.ProductivityApps.com

> Is it possible to copy a word document page but leave the first 3 space
> behind on every line for the whole document I need to do this for over 3000
[quoted text clipped - 17 lines]
>
> Marcus
Chuck Henrich - 27 Jul 2005 11:50 GMT
An alternative method not using a macro would be to use a wildcard search:

Search for:  ([0-9]{3}) (*)
Replace with:  \2

(Note that there is a space after {3} and before the closing round bracket.  
{3} specifies how may digits - if there were 5 digits you'd change the 3 to a
5.  Make sure "Use wildcards" is ticked.)

By putting round brackets around any text you can "mark" it as a discrete
component that can be referred to in the replace with field as "\1" (first
bracketed section), "\2" (second bracketed section) etc.

For more information look at the (murky) help section on wildcard searches.

HTH
Signature

Chuck Henrich
www.ProductivityApps.com

> Is it possible to copy a word document page but leave the first 3 space
> behind on every line for the whole document I need to do this for over 3000
[quoted text clipped - 17 lines]
>
> Marcus
Graham Mayor - 27 Jul 2005 14:48 GMT
> For more information look at the (murky) help section on wildcard
> searches.
>
> HTH

For less murk see http://www.gmayor.com/replace_using_wildcards.htm

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

Chuck Henrich - 27 Jul 2005 15:50 GMT
Excellent resource - thanks Graham!
Signature

Chuck Henrich
www.ProductivityApps.com

> > For more information look at the (murky) help section on wildcard
> > searches.
> >
> > HTH
>
> For less murk see http://www.gmayor.com/replace_using_wildcards.htm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.