Hi Jezebel,
I am looking forward to testing the code you have given
for testing. Here is the whole code (which is still
stoping on lines, you will see why) is below. If you
have the time I would like to know how to create arrays
as there is not a type array as there is in Excel VBA and
what appears to be every other programming language out
there. Finally is there a way to write the spaces
instead of type.text and put in 40 spaces etc.
Thank you,
Aaron
Sub CleanBottomMoney()
Dim iLn1 As Integer ' Line 1 of 2
Dim iLn2 As Integer ' Line 2 of 2
Dim iPg1 As Integer ' Last Page
Dim iStr As Integer ' line to start with
Dim iEnd As Integer ' line to stop at
Dim SignLen, SignCenter, SignPaste As Integer
With ActiveWindow ' word bug workaround
.View = wdPrintView
.View = wdNormalView
.View = wdPrintView
End With
iPg1 = Selection.Information(wdNumberOfPagesInDocument)
MsgBox (iPg1)
Selection.ExtendMode = False
Selection.GoTo What:=wdGoToPage, Count:=iPg1
With Selection
.Collapse
.ExtendMode = False
iLn1 = .Information(wdFirstCharacterLineNumber) 'set
line one advancer
.MoveDown
iLn2 = .Information(wdFirstCharacterLineNumber) ' set
line two advancer
While iLn1 <> iLn2
.Bookmarks("\line").Select
If Len(.Range.Text) > 24 Then
''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''
' Clean the PO area and bring the total to the
correct line '
''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''
If .Range.Characters(2).Text = "P" _
And .Range.Characters(3).Text = "." Then
.Range.Characters(55).Select
While .Text Like "[A-z,0-9]"
.MoveRight unit:=wdCharacter, Count:=1
SignLen = SignLen + 1
Wend
MsgBox (SignLen)
.MoveLeft unit:=wdCharacter, Count:=SignLen,
Extend:=wdExtend
.Cut
'Perform the calculations to where it should
be pasted 'on the PO line.
SignCenter = Round(SignLen / 2)
SignPaste = (13 - SignCenter) + 12
'Paste the signature and delete excess
line
.Bookmarks("\line").Select
.Range.Characters(SignPaste).Select
.Paste
.MoveLeft unit:=wdCharacter,
Count:=SignLen, Extend:=wdExtend
If Selection.Font.Underline =
wdUnderlineNone Then
Selection.Font.Underline =
wdUnderlineSingle
Else
Selection.Font.Underline =
wdUnderlineNone
End If
.MoveRight unit:=wdCharacter,
Count:=1, Extend:=False
.Delete unit:=wdCharacter, Count:=
(SignLen - 1)
'Delete Excess spaces and bring
total to correct line
.MoveRight unit:=wdCharacter,
Count:=18, Extend:=False
.Delete unit:=wdCharacter, Count:=
(40 - SignLen)
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''
' Take care of Subtotal line and other lines
'''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''
If .Range.Characters(24) = "S" Then
.Range.Characters(24).Select
.MoveRight Count:=12, Extend:=wdExtend
If .Range.Text = "SUBTOTAL....:" Then
MsgBox ("this is it")
.MoveLeft
.TypeText
Text:=" "
End If
Else
If .Range.Characters(30) = "=" Then
.Range.Characters(30).Select
.TypeText
Text:="
"
End If
If .Range.Characters(24) = "D"
And .Range.Characters(25) = "E" _
And .Range.Characters(26) = "L" Then
.Range.Characters(24).Select
.TypeText
Text:=" "
End If
If Len(.Range.Text) > 78 Then
If .Range.Characters(79) = "D" Then
.Range.Characters(80).Select
.Delete unit:=wdCharacter, Count:=79
End If
End If
End If
End If
iLn1 = .Information(wdFirstCharacterLineNumber)
.MoveDown
iLn2 = .Information(wdFirstCharacterLineNumber)
Wend
End With
MsgBox ("Have a Nice Day")
End Sub
>-----Original Message-----
>First, for this sort of coding you shouldn't be using the Selection object
[quoted text clipped - 91 lines]
>
>.
Jezebel - 09 Oct 2004 01:18 GMT
Not sure what you're getting at about type arrays. Word VBA, Excel VBA, and
all the other VBAs are (by definition) identical -- it's whatever version of
the "VBA for applications" library is installed on your computer -- Word,
Excel, and all other VBA-enabled applications use this same library for
their basic functions. If you're having problems declaring an array of a
UDT, then there is some other problem with your code; but in any case you
might find it easier to use a collection of class objects.
An alternative to TypeText is to use the various the Range object's Insert
methods. Or you can simply redefine the Range's Text property.
> Hi Jezebel,
>
[quoted text clipped - 260 lines]
> >
> >.
Steve Rindsberg - 04 Nov 2004 19:56 GMT
> I am looking forward to testing the code you have given
> for testing. Here is the whole code (which is still
[quoted text clipped - 3 lines]
> what appears to be every other programming language out
> there.
Dim MyArray(1 to 10) as String ' a ten-element array of strings
Dim MyBiggerArray(1 to 10, 1 to 100) as Object ' a 10 by 100 array of objects
> Finally is there a way to write the spaces
> instead of type.text and put in 40 spaces etc.
Debug.Print "There are 20 spaces between here -->" & space(20) & "<-- and here"
> Thank you,
>
[quoted text clipped - 249 lines]
> >
> >.

Signature
--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Apologies for the delayed response.
Just back from PowerPoint Live 2004
Had a great time, learned a lot
================================================