********** EEPgTVBW.TXT: Programmes Simples En VB Pour Word **********
HeWo1Vbw.HTM   Wr2x2Vbw.HTM
HeWo9Vbw.HTM   WrClcVbw.HTM   Chr20Vbw.HTM
HeWo5Vbw.HTM   WrMsgVbw.HTM   PrmNbVbw.HTM

Sub HelloWorld1()
   Selection.TypeText ("Hello World...")
End Sub
                                      !----------------------------------------
Sub HelloWorld5()                     ! Sub Chr20_FF()
   Selection.TypeText                 !    Dim i
         ("Hello World....." & vbCrLf)!
   Selection.TypeText                 !    Selection.TypeText ("***** CHARS: ")
         ("Hello World....." & vbCrLf)!
   Selection.TypeText                 !    '----- LOOP
         ("Hello World....." & vbCrLf)!    For i = 32 To 255
   Selection.TypeText                 !       Selection.TypeText (Chr(i))
         ("Hello World....." & vbCrLf)!    Next
   Selection.TypeText                 ! End Sub
         ("Hello World....." & vbCrLf)!
End Sub                               ! Sub PrimeNb()
                                      !    Dim IsPrimeArray(1000)
                                      !    Dim i
Sub HelloWorld9()                     !    Dim j, jMax
   Dim i                              !
                                      !    Selection.TypeText
   '----- LOOP                        !              ("***** PRIME NUMBERS: ")
   For i = 1 To 9                     !
      Selection.TypeText              !    '----- LOOP 1 , On each number
     ("Hello World........." & vbCrLf)!    For i = 1 To 1000
   Next                               !
End Sub                               !       '----- Could be a prime number
                                      !       IsPrimeArray(i) = True
                                      !
Sub Write2x2()                        !       '----- LOOP 2 , Search a divisor
   Selection.TypeText (2 + 2)         !       j = 2
End Sub                               !       jMax = i \ 2      '--- Int div
                                      !
                                      !       While IsPrimeArray(i)
Sub WriteCalc()                       !                        And (j <= jMax)
   Dim R                              !          '----- "j" can divide "i" ?
   Dim C, A                           !          If (i Mod j) = 0 Then
                                      !             IsPrimeArray(i) = False
   R = 10                             !          End If
                                      !          j = j + 1
   C = 2 * 3.14159 * R                !       Wend
   A = 3.14159 * R * R                !
                                      !       '----- Display only prime numbers
   Selection.TypeText                 !       If IsPrimeArray(i) = True Then
              ("Radius=" & R & vbCrLf)!          Selection.TypeText (i & " ")
   Selection.TypeText                 !       End If
       ("Circumference=" & C & vbCrLf)!    Next i
   Selection.TypeText                 ! /* [<--           i            -->]
                ("Area=" & A & vbCrLf)!     [<-j->]
End Sub                               !    .#.............#...............#
                                      !     |     |                       |
                                      !     2   i div 2                 1000 */
Sub WriteMsg()                        ! End Sub
   Dim MyMsg                          !----------------------------------------

   MyMsg = "- Nice weather, isn't it ?" & vbCrLf _
          & "- Yes ""nice"" weather." & vbCrLf

   Selection.TypeText (MyMsg)
End Sub
