|
-
Feb 21st, 2006, 12:26 PM
#1
Thread Starter
Member
Macro help
I am trying to write a macro that would print everything from the "(" until the end of the page. Then the start of page 2 would start with the next "(" and all that follows to fill up page 2 and so on.
the doc. and each section starts like this:
( DIAMETER = .125 )
( CORNER RADIUS = .0625 )
( STOCK ALLOWANCE = -.006 )
G91 G28 Z0
H0 G49
T2
M6
G90
M3 S1500
G5 P1
G61.1
X.4733 Y0
G43 Z-1.5254 H2 M50
X-.0102 Y-.3277
Z-2.0254
G1 Z-2.1324 F35.
X-.0099 Y-.3169 F70.
X-.0066 Y-.3126
and this goes on for pages until the next section that starts the same way.
Essentially, I would like a three hundred page document that has say 10 different sections, these all start with parenthesis, to print out ten pages, each page starting with the next section. Could someone help me with creating this code, nothing is working, I know very little about this but am trying to learn. Any help is appreciated.
-
Feb 21st, 2006, 01:20 PM
#2
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Feb 21st, 2006, 01:33 PM
#3
Thread Starter
Member
Re: Macro help
A word doc, here is the code that I have now:
Dim lineNumber, deleteAt, i, CharPos1, CharPos2 As Long
Dim rng As Range
Dim temp As String
lineNumber = ActiveDocument.Sentences.Count
If lineNumber > 57 Then
ActiveDocument.Sentences(58).Select
CharPos1 = Selection.Range.Start
Selection.MoveUntil Cset:="("
CharPos2 = Selection.Range.Start
ActiveDocument.Range(Start:=CharPos1, End:=CharPos2).Select
Selection.Delete
End If
This is good enough to keep 57 lines, goto the next '(', delete everything in between from line 58 up until the "(", and start page two with the next section,(section#).
I am looking for help to loop this somehow so at page 2 it will keep 57 lines, skip to the next "(", delete the in between stuff and start page 3 with "(Section#)",57lines, etc.
Last edited by wooonelly; Feb 21st, 2006 at 02:24 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|