A
Aaron
Hi Helmut,
Sorry so long to get back. Running the whole show can
get busy. I still am hazy on how the information works
and what 10 is for. In the help file I kind of
understand what is going on.. but did
not find any 10.
Thank you so very much for your help. I am sure as I
program these deals I will have more questions. Below is
the Code that I ended up with and that works with what I
am trying to do, I hope it will benefit the rest of the
group.
Please let me know if it is in bad taste to start a new
post, I figured that since the solution would be burried
it would benefit more in a new string.
Thank you,
Aaron
****************************************************
Begin solution
****************************************************
Sub CleanItemOverages()
Dim iLn1 As Integer ' Line 1 of 2
Dim iLn2 As Integer ' Line 2 of 2
Dim iStr As Integer ' line to start with
Dim iEnd As Integer ' line to stop at
With ActiveWindow ' word bug workaround
.View = wdPrintView
.View = wdNormalView
.View = wdPrintView
End With
iStr = 14
Selection.ExtendMode = False
Selection.GoTo what:=wdGoToLine, which:=wdGoToFirst,
Count:=iStr
With Selection
.Collapse
.ExtendMode = False
iLn1 = .Information(wdFirstCharacterLineNumber)
.Bookmarks("\line").Select
If Len(.Range.Text) > 60 Then
If .Range.Characters(28) <> " " Then
.Range.Characters(26).Select 'was 26
.MoveRight Count:=3, Extend:=wdExtend
If Selection.Range.Text = "pay " Then
End
Else
Selection.MoveUp Unit:=wdLine, Count:=1
Call CleanLine
End If
End If
End If
.MoveDown
iLn2 = .Information(wdFirstCharacterLineNumber)
While iLn1 <> iLn2
.Bookmarks("\line").Select
If Len(.Range.Text) > 60 Then
If .Range.Characters(28) <> " " Then
.Range.Characters(26).Select 'was 26
.MoveRight Count:=3, Extend:=wdExtend
If Selection.Range.Text = "pay " Then
End
Else
Selection.MoveUp Unit:=wdLine, Count:=1
Call CleanLine
End If
End If
End If
iLn1 = .Information(wdFirstCharacterLineNumber)
.MoveDown
iLn2 = .Information(wdFirstCharacterLineNumber)
Wend
End With
End Sub
********************************
CleanLine
********************************
Sub CleanLine()
Selection.MoveRight Unit:=wdCharacter, Count:=24
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & " "
Selection.MoveRight Unit:=wdCharacter, Count:=14
Selection.MoveRight Unit:=wdCharacter, Count:=21,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=5
End Sub
Sorry so long to get back. Running the whole show can
get busy. I still am hazy on how the information works
and what 10 is for. In the help file I kind of
understand what is going on.. but did
not find any 10.
Thank you so very much for your help. I am sure as I
program these deals I will have more questions. Below is
the Code that I ended up with and that works with what I
am trying to do, I hope it will benefit the rest of the
group.
Please let me know if it is in bad taste to start a new
post, I figured that since the solution would be burried
it would benefit more in a new string.
Thank you,
Aaron
****************************************************
Begin solution
****************************************************
Sub CleanItemOverages()
Dim iLn1 As Integer ' Line 1 of 2
Dim iLn2 As Integer ' Line 2 of 2
Dim iStr As Integer ' line to start with
Dim iEnd As Integer ' line to stop at
With ActiveWindow ' word bug workaround
.View = wdPrintView
.View = wdNormalView
.View = wdPrintView
End With
iStr = 14
Selection.ExtendMode = False
Selection.GoTo what:=wdGoToLine, which:=wdGoToFirst,
Count:=iStr
With Selection
.Collapse
.ExtendMode = False
iLn1 = .Information(wdFirstCharacterLineNumber)
.Bookmarks("\line").Select
If Len(.Range.Text) > 60 Then
If .Range.Characters(28) <> " " Then
.Range.Characters(26).Select 'was 26
.MoveRight Count:=3, Extend:=wdExtend
If Selection.Range.Text = "pay " Then
End
Else
Selection.MoveUp Unit:=wdLine, Count:=1
Call CleanLine
End If
End If
End If
.MoveDown
iLn2 = .Information(wdFirstCharacterLineNumber)
While iLn1 <> iLn2
.Bookmarks("\line").Select
If Len(.Range.Text) > 60 Then
If .Range.Characters(28) <> " " Then
.Range.Characters(26).Select 'was 26
.MoveRight Count:=3, Extend:=wdExtend
If Selection.Range.Text = "pay " Then
End
Else
Selection.MoveUp Unit:=wdLine, Count:=1
Call CleanLine
End If
End If
End If
iLn1 = .Information(wdFirstCharacterLineNumber)
.MoveDown
iLn2 = .Information(wdFirstCharacterLineNumber)
Wend
End With
End Sub
********************************
CleanLine
********************************
Sub CleanLine()
Selection.MoveRight Unit:=wdCharacter, Count:=24
Selection.TypeParagraph
Selection.TypeText Text:=vbTab & vbTab & " "
Selection.MoveRight Unit:=wdCharacter, Count:=14
Selection.MoveRight Unit:=wdCharacter, Count:=21,
Extend:=wdExtend
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=5
End Sub