home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Formatter2182145312010.psc / Formatter.Frm < prev    next >
Text File  |  2010-05-12  |  48KB  |  1,251 lines

  1. VERSION 5.00
  2. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
  3. Begin VB.Form FormatterMain 
  4.    BackColor       =   &H80000016&
  5.    Caption         =   "Formatter     (www.RandyGrams.com)"
  6.    ClientHeight    =   5525
  7.    ClientLeft      =   104
  8.    ClientTop       =   455
  9.    ClientWidth     =   9126
  10.    BeginProperty Font 
  11.       Name            =   "Times New Roman"
  12.       Size            =   12
  13.       Charset         =   0
  14.       Weight          =   700
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    Icon            =   "Formatter.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    ScaleHeight     =   425
  22.    ScaleMode       =   3  'Pixel
  23.    ScaleWidth      =   702
  24.    Begin VB.PictureBox picTopBotFrame 
  25.       Appearance      =   0  'Flat
  26.       BackColor       =   &H8000000C&
  27.       BorderStyle     =   0  'None
  28.       ForeColor       =   &H80000008&
  29.       Height          =   2847
  30.       Left            =   130
  31.       ScaleHeight     =   219
  32.       ScaleMode       =   3  'Pixel
  33.       ScaleWidth      =   628
  34.       TabIndex        =   9
  35.       Top             =   130
  36.       Width           =   8164
  37.       Begin VB.PictureBox picNumSpaces 
  38.          Appearance      =   0  'Flat
  39.          BackColor       =   &H80000016&
  40.          BorderStyle     =   0  'None
  41.          ForeColor       =   &H80000008&
  42.          Height          =   858
  43.          Left            =   3744
  44.          ScaleHeight     =   66
  45.          ScaleMode       =   3  'Pixel
  46.          ScaleWidth      =   330
  47.          TabIndex        =   17
  48.          Top             =   975
  49.          Width           =   4290
  50.          Begin VB.TextBox txtNumSpaces 
  51.             Alignment       =   2  'Center
  52.             Appearance      =   0  'Flat
  53.             BackColor       =   &H80000016&
  54.             BorderStyle     =   0  'None
  55.             BeginProperty DataFormat 
  56.                Type            =   1
  57.                Format          =   "0"
  58.                HaveTrueFalseNull=   0
  59.                FirstDayOfWeek  =   0
  60.                FirstWeekOfYear =   0
  61.                LCID            =   1033
  62.                SubFormatType   =   1
  63.             EndProperty
  64.             BeginProperty Font 
  65.                Name            =   "Times New Roman"
  66.                Size            =   28
  67.                Charset         =   0
  68.                Weight          =   700
  69.                Underline       =   0   'False
  70.                Italic          =   0   'False
  71.                Strikethrough   =   0   'False
  72.             EndProperty
  73.             ForeColor       =   &H80000001&
  74.             Height          =   624
  75.             Left            =   3601
  76.             MaxLength       =   2
  77.             TabIndex        =   18
  78.             Text            =   "4"
  79.             ToolTipText     =   "Enter the number of spaces between the Border and the Text!"
  80.             Top             =   117
  81.             Width           =   650
  82.          End
  83.          Begin VB.Label lblNumSpaces 
  84.             BackColor       =   &H80000016&
  85.             Caption         =   "Enter the number of spaces before the Asterisks (*).      This includes the Tick mark (')."
  86.             ForeColor       =   &H00000000&
  87.             Height          =   780
  88.             Left            =   117
  89.             TabIndex        =   19
  90.             Top             =   39
  91.             Width           =   3172
  92.          End
  93.       End
  94.       Begin VB.PictureBox picTopBotBars 
  95.          Appearance      =   0  'Flat
  96.          BackColor       =   &H80000016&
  97.          BorderStyle     =   0  'None
  98.          ForeColor       =   &H80000008&
  99.          Height          =   858
  100.          Left            =   130
  101.          ScaleHeight     =   66
  102.          ScaleMode       =   3  'Pixel
  103.          ScaleWidth      =   268
  104.          TabIndex        =   14
  105.          Top             =   975
  106.          Width           =   3484
  107.          Begin VB.TextBox txtTopBotBars 
  108.             Alignment       =   2  'Center
  109.             Appearance      =   0  'Flat
  110.             BackColor       =   &H80000016&
  111.             BorderStyle     =   0  'None
  112.             BeginProperty DataFormat 
  113.                Type            =   1
  114.                Format          =   "0"
  115.                HaveTrueFalseNull=   0
  116.                FirstDayOfWeek  =   0
  117.                FirstWeekOfYear =   0
  118.                LCID            =   1033
  119.                SubFormatType   =   1
  120.             EndProperty
  121.             BeginProperty Font 
  122.                Name            =   "Times New Roman"
  123.                Size            =   28
  124.                Charset         =   0
  125.                Weight          =   700
  126.                Underline       =   0   'False
  127.                Italic          =   0   'False
  128.                Strikethrough   =   0   'False
  129.             EndProperty
  130.             ForeColor       =   &H80000001&
  131.             Height          =   624
  132.             Left            =   2795
  133.             MaxLength       =   2
  134.             TabIndex        =   15
  135.             Text            =   "2"
  136.             ToolTipText     =   "Enter the number of Top and Bottom Border lines!"
  137.             Top             =   117
  138.             Width           =   650
  139.          End
  140.          Begin VB.Label lblTopBotBars 
  141.             BackColor       =   &H80000016&
  142.             Caption         =   "Enter the number of Top and Bottom Border Bars!"
  143.             ForeColor       =   &H00000000&
  144.             Height          =   520
  145.             Left            =   130
  146.             TabIndex        =   16
  147.             Top             =   169
  148.             Width           =   2691
  149.             WordWrap        =   -1  'True
  150.          End
  151.       End
  152.       Begin VB.TextBox txtSideFormat 
  153.          BackColor       =   &H00E2EFF1&
  154.          BeginProperty Font 
  155.             Name            =   "OCRB"
  156.             Size            =   12
  157.             Charset         =   0
  158.             Weight          =   700
  159.             Underline       =   0   'False
  160.             Italic          =   0   'False
  161.             Strikethrough   =   0   'False
  162.          EndProperty
  163.          ForeColor       =   &H00FF0000&
  164.          Height          =   390
  165.          Left            =   130
  166.          TabIndex        =   13
  167.          Text            =   "'   ****                                                                 ****"
  168.          Top             =   2353
  169.          Width           =   7904
  170.       End
  171.       Begin VB.TextBox txtTopBotFormat 
  172.          BackColor       =   &H00E2EFF1&
  173.          BeginProperty Font 
  174.             Name            =   "OCRB"
  175.             Size            =   12
  176.             Charset         =   0
  177.             Weight          =   700
  178.             Underline       =   0   'False
  179.             Italic          =   0   'False
  180.             Strikethrough   =   0   'False
  181.          EndProperty
  182.          ForeColor       =   &H00FF0000&
  183.          Height          =   390
  184.          Left            =   130
  185.          TabIndex        =   10
  186.          Text            =   "'   *************************************************************************"
  187.          Top             =   65
  188.          Width           =   7904
  189.       End
  190.       Begin VB.Label lblSideFormat 
  191.          Alignment       =   2  'Center
  192.          BackColor       =   &H80000016&
  193.          Caption         =   "Enter the format for the sides of the text box below."
  194.          ForeColor       =   &H00000000&
  195.          Height          =   286
  196.          Left            =   1222
  197.          TabIndex        =   12
  198.          Top             =   1950
  199.          Width           =   5720
  200.       End
  201.       Begin VB.Label lblTopBotFormat 
  202.          Alignment       =   2  'Center
  203.          BackColor       =   &H80000016&
  204.          Caption         =   "Enter the Top and Bottom line format above."
  205.          ForeColor       =   &H00000000&
  206.          Height          =   286
  207.          Left            =   1222
  208.          TabIndex        =   11
  209.          Top             =   572
  210.          Width           =   5720
  211.       End
  212.    End
  213.    Begin VB.PictureBox picEnterComments 
  214.       Appearance      =   0  'Flat
  215.       BackColor       =   &H80000016&
  216.       BorderStyle     =   0  'None
  217.       ForeColor       =   &H80000008&
  218.       Height          =   1430
  219.       Left            =   130
  220.       ScaleHeight     =   110
  221.       ScaleMode       =   3  'Pixel
  222.       ScaleWidth      =   685
  223.       TabIndex        =   6
  224.       Top             =   3965
  225.       Width           =   8905
  226.       Begin VB.TextBox txtEnterComments 
  227.          BackColor       =   &H00E2EFF1&
  228.          BeginProperty Font 
  229.             Name            =   "OCRB"
  230.             Size            =   12
  231.             Charset         =   0
  232.             Weight          =   700
  233.             Underline       =   0   'False
  234.             Italic          =   0   'False
  235.             Strikethrough   =   0   'False
  236.          EndProperty
  237.          ForeColor       =   &H00000000&
  238.          Height          =   715
  239.          Left            =   468
  240.          MultiLine       =   -1  'True
  241.          ScrollBars      =   3  'Both
  242.          TabIndex        =   20
  243.          Text            =   "Formatter.frx":0CCA
  244.          Top             =   468
  245.          Width           =   5512
  246.       End
  247.       Begin VB.CheckBox chkLeftAlign 
  248.          Appearance      =   0  'Flat
  249.          BackColor       =   &H80000016&
  250.          Caption         =   "Add - ""Left Align"" statement."
  251.          ForeColor       =   &H80000008&
  252.          Height          =   260
  253.          Left            =   5252
  254.          TabIndex        =   7
  255.          Top             =   0
  256.          Width           =   3419
  257.       End
  258.       Begin VB.Label lblEnterComments 
  259.          Alignment       =   2  'Center
  260.          AutoSize        =   -1  'True
  261.          BackColor       =   &H80000016&
  262.          Caption         =   "Enter your comments below, then press 'Format'!"
  263.          ForeColor       =   &H00000000&
  264.          Height          =   260
  265.          Left            =   78
  266.          TabIndex        =   8
  267.          Top             =   0
  268.          Width           =   4966
  269.       End
  270.    End
  271.    Begin VB.PictureBox picCommandBar 
  272.       Appearance      =   0  'Flat
  273.       BackColor       =   &H80000016&
  274.       BorderStyle     =   0  'None
  275.       ForeColor       =   &H80000008&
  276.       Height          =   754
  277.       Left            =   130
  278.       ScaleHeight     =   58
  279.       ScaleMode       =   3  'Pixel
  280.       ScaleWidth      =   525
  281.       TabIndex        =   0
  282.       Top             =   3094
  283.       Width           =   6825
  284.       Begin VB.CommandButton cmdClear 
  285.          BackColor       =   &H80000016&
  286.          Caption         =   "Clear!"
  287.          Height          =   754
  288.          Left            =   0
  289.          MaskColor       =   &H80000007&
  290.          Style           =   1  'Graphical
  291.          TabIndex        =   5
  292.          ToolTipText     =   "  Erase  A L L  text!  "
  293.          Top             =   0
  294.          Width           =   1001
  295.       End
  296.       Begin VB.CommandButton cmdFormat 
  297.          BackColor       =   &H80000016&
  298.          Caption         =   "Format!"
  299.          Height          =   754
  300.          Left            =   1118
  301.          MaskColor       =   &H80000007&
  302.          Style           =   1  'Graphical
  303.          TabIndex        =   4
  304.          ToolTipText     =   "This will Format the Text using the current parameters."
  305.          Top             =   0
  306.          Width           =   1196
  307.       End
  308.       Begin VB.CommandButton cmdCopy 
  309.          BackColor       =   &H80000016&
  310.          Caption         =   "Copy!"
  311.          Height          =   754
  312.          Left            =   2431
  313.          MaskColor       =   &H80000007&
  314.          Style           =   1  'Graphical
  315.          TabIndex        =   3
  316.          ToolTipText     =   "Copy the Text to the ClipBoard!"
  317.          Top             =   0
  318.          Width           =   1001
  319.       End
  320.       Begin VB.CommandButton cmdSaveText 
  321.          BackColor       =   &H80000016&
  322.          Caption         =   "Save Text!"
  323.          Height          =   754
  324.          Left            =   3549
  325.          MaskColor       =   &H80000007&
  326.          Style           =   1  'Graphical
  327.          TabIndex        =   2
  328.          ToolTipText     =   "Temporarily Save the Text!"
  329.          Top             =   0
  330.          Width           =   1430
  331.       End
  332.       Begin VB.CommandButton cmdRestoreText 
  333.          BackColor       =   &H80000016&
  334.          Caption         =   "Restore Text!"
  335.          Height          =   754
  336.          Left            =   5096
  337.          MaskColor       =   &H80000007&
  338.          Style           =   1  'Graphical
  339.          TabIndex        =   1
  340.          ToolTipText     =   "Restore the Text!"
  341.          Top             =   0
  342.          Width           =   1729
  343.       End
  344.    End
  345.    Begin MSComDlg.CommonDialog CDB 
  346.       Left            =   8073
  347.       Top             =   3094
  348.       _ExtentX        =   847
  349.       _ExtentY        =   847
  350.       _Version        =   393216
  351.    End
  352.    Begin VB.Menu mnuFile 
  353.       Caption         =   "File"
  354.       Begin VB.Menu mnuFileNew 
  355.          Caption         =   "New"
  356.       End
  357.       Begin VB.Menu mnuFileOpen 
  358.          Caption         =   "Open"
  359.       End
  360.       Begin VB.Menu mnuFileSave 
  361.          Caption         =   "Save"
  362.       End
  363.       Begin VB.Menu mnuFileSaveAs 
  364.          Caption         =   "Save As"
  365.       End
  366.    End
  367.    Begin VB.Menu mnuEdit 
  368.       Caption         =   "Edit"
  369.       Begin VB.Menu mnuEditCopy 
  370.          Caption         =   "Copy"
  371.       End
  372.       Begin VB.Menu mnuEditCut 
  373.          Caption         =   "Cut"
  374.       End
  375.       Begin VB.Menu mnuEditPaste 
  376.          Caption         =   "Paste"
  377.       End
  378.       Begin VB.Menu mnuEditSelectAll 
  379.          Caption         =   "Select All"
  380.       End
  381.       Begin VB.Menu mnuUnFormat 
  382.          Caption         =   "Un-Format"
  383.       End
  384.    End
  385.    Begin VB.Menu mnuFormatter 
  386.       Caption         =   "Help"
  387.       Begin VB.Menu mnuAbout 
  388.          Caption         =   "About"
  389.       End
  390.       Begin VB.Menu mnuHelp 
  391.          Caption         =   "&Help"
  392.          Shortcut        =   ^H
  393.       End
  394.       Begin VB.Menu mnuQuit 
  395.          Caption         =   "&Quit"
  396.          Shortcut        =   ^Q
  397.       End
  398.    End
  399.    Begin VB.Menu mnuSample 
  400.       Caption         =   "Show Sample"
  401.    End
  402. End
  403. Attribute VB_Name = "FormatterMain"
  404. Attribute VB_GlobalNameSpace = False
  405. Attribute VB_Creatable = False
  406. Attribute VB_PredeclaredId = True
  407. Attribute VB_Exposed = False
  408. '
  409. '   *************************************************************************
  410. '   *************************************************************************
  411. '   ****                                                                 ****
  412. '   ****    Formatter                                                    ****
  413. '   ****                                                                 ****
  414. '   ****    Written by:    Randy Giese    (12/10/02)                     ****
  415. '   ****                                                                 ****
  416. '   ****    This program will build comment fields like this one so      ****
  417. '   ****    that you may put them into your own programs. Run this       ****
  418. '   ****    program and type or paste anything you like in the Text      ****
  419. '   ****    Box.                                                         ****
  420. '   ****                                                                 ****
  421. '   ****    If you want a phrase or sentence to be on it's own line,     ****
  422. '   ****    just press 'Enter' at the end of the line.                   ****
  423. '   ****    For example:                                                 ****
  424. '   ****    I pressed 'Enter' after the word "line." and again after     ****
  425. '   ****    the word "example:" in the 2 lines above.  That will make    ****
  426. '   ****    the line "For example:" be on a line by itself.              ****
  427. '   ****                                                                 ****
  428. '   *************************************************************************
  429. '   ****                                                                 ****
  430. '   ****    December 05, 2009                                            ****
  431. '   ****                                                                 ****
  432. '   ****    I changed the "ScaleMode" property on the Form and all       ****
  433. '   ****    Picture Boxes from Twips to Pixels.                          ****
  434. '   ****                                                                 ****
  435. '   ****    I modified the Form Layout slightly and changed the          ****
  436. '   ****    Maximum Length of the Format Bars from 99 to 500.            ****
  437. '   ****                                                                 ****
  438. '   ****    I also changed the Rich Text Box to a plain Text Box         ****
  439. '   ****    since no RTB features were being utilized.                   ****
  440. '   ****                                                                 ****
  441. '   ****    I did a little minor "Code Cleanup" and removed the          ****
  442. '   ****    temporary Text file.                                         ****
  443. '   ****                                                                 ****
  444. '   ****    I now check for the Screen Width in Pixels.  If the          ****
  445. '   ****    Screen Width is <1100 Pixels, I change the Font and the      ****
  446. '   ****    Size of the 2 labels that are centered within the Gray       ****
  447. '   ****    box above.  That gives sufficient room to correctly          ****
  448. '   ****    display the 2 Text boxes that are also in the Gray box       ****
  449. '   ****    above.                                                       ****
  450. '   ****                                                                 ****
  451. '   *************************************************************************
  452. '   ****                                                                 ****
  453. '   ****    December 15, 2009                                            ****
  454. '   ****                                                                 ****
  455. '   ****    I used the "Split" function to replace a large segment of    ****
  456. '   ****    "If Then" statements that used "InStr" and "InStrRev" to     ****
  457. '   ****    find and remove all of the Asterisks "*" and Spaces " "      ****
  458. '   ****    from the line of data.  Split is much quicker and more       ****
  459. '   ****    efficient both "Timewise" and "Spacewise".                   ****
  460. '   ****                                                                 ****
  461. '   *************************************************************************
  462. '
  463. '   *************************************************************************
  464. '   *************************************************************************
  465. '   ****                                                                 ****
  466. '   ****    If you leave a Blank line in your text, it will leave a      ****
  467. '   ****    Blank line in the formatted output as well, like this:       ****
  468. '   ****                                                                 ****
  469. '   ****    And, if you want to have a Breaker bar in your formatted     ****
  470. '   ****    output, leave 2 Blank lines.                                 ****
  471. '   ****                                                                 ****
  472. '   *************************************************************************
  473. '   ****                                                                 ****
  474. '   ****    Each consecutive Blank line will add another Breaker bar     ****
  475. '   ****    in your formatted output.                                    ****
  476. '   ****                                                                 ****
  477. '   *************************************************************************
  478. '   *************************************************************************
  479. '   *************************************************************************
  480. '   ****                                                                 ****
  481. '   ****    Multiple Breaker bars are displayed above.                   ****
  482. '   ****                                                                 ****
  483. '   *************************************************************************
  484. '   *************************************************************************
  485. '
  486. '   *************************************************************************
  487. '   *************************************************************************
  488. '   ****                                                                 ****
  489. '   ****    Below is the text used to generate the previous Formatted    ****
  490. '   ****    output.  You may try it yourself by selecting and copying    ****
  491. '   ****    the text field below.  Then run the program and paste the    ****
  492. '   ****    text into the text box.  Remove the tick marks (') but do    ****
  493. '   ****    not delete any blank lines.  Then click Format.              ****
  494. '   ****                                                                 ****
  495. '   ****    The Formatted text should look like the text above here.     ****
  496. '   ****                                                                 ****
  497. '   *************************************************************************
  498. '   *************************************************************************
  499. '
  500. '
  501. '   If you leave a Blank line in your text, it will leave a Blank line in the formatted output as well, like this:
  502. '
  503. '   And, if you want to have a Breaker bar in your formatted output, leave 2 Blank lines.
  504. '
  505. '
  506. '   Each consecutive Blank line will add another Breaker bar in your formatted output.
  507. '
  508. '
  509. '
  510. '
  511. '   Multiple Breaker bars are displayed above.
  512. '
  513. '
  514. '
  515. '   RandyGrams Comments - Left Align the above comments.
  516.  
  517. 'Enter the number of spaces between the Border and the Text!
  518. Option Explicit
  519.  
  520. Private lngBorderEnd         As Long
  521. Private lngCounter           As Long
  522. Private lngFieldEnd          As Long
  523. Private lngFieldSize         As Long
  524. Private lngLeftBorder        As Long
  525. Private lngLoop2             As Long
  526. Private lngScreenWide        As Long
  527. Private lngSequentialCRLF    As Long
  528. Private lngSpaces            As Long
  529.  
  530. Private strArray()           As String
  531. Private strBreakerBar        As String
  532. Private strOpenFile          As String
  533. Private strSave              As String
  534. Private strSideFormatBar     As String
  535. Private strTopFormatBar      As String
  536.  
  537. 'Define Constants
  538. Private Const SM_CXSCREEN    As Long = 0    'Width of screen
  539. Private Const SW_MAXIMIZE    As Long = 3
  540.  
  541. Private Declare Function DeleteFile Lib "kernel32.dll" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
  542. Private Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
  543. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
  544. Private Declare Sub InitCommonControls Lib "comctl32" ()
  545.  
  546. Public Sub BreakerBar()
  547. '
  548. '   *************************************************************************
  549. '   ****                                                                 ****
  550. '   ****    This will determine if a Breaker Bar is needed or if it's    ****
  551. '   ****    just a blank line.                                           ****
  552. '   ****                                                                 ****
  553. '   ****    If lngSequentialCRLF = 1 then we just print a blank line.    ****
  554. '   ****    If it's > 1, then we print a Breaker Bar.                    ****
  555. '   ****                                                                 ****
  556. '   *************************************************************************
  557. '
  558.     If LenB(strArray(lngCounter)) = 0 Then
  559.         lngSequentialCRLF = lngSequentialCRLF + 1
  560.  
  561.         If lngSequentialCRLF > 1 Then
  562. '           This will cause the program to print a Breaker Bar.
  563.             strArray(lngCounter) = "Place a BreakerBar here!"
  564.         End If
  565.     Else
  566. '
  567. '   *************************************************************************
  568. '   ****                                                                 ****
  569. '   ****    If this line has text but lngSequentialCRLF > 1 then         ****
  570. '   ****    insert a Blank line into the array.                          ****
  571. '   ****                                                                 ****
  572. '   *************************************************************************
  573. '
  574. '   RandyGrams Comments - Left Align the above comments.
  575.  
  576.         If lngSequentialCRLF > 1 Then
  577.             lngCounter = lngCounter + 1     'This will be the number of the current array string
  578.             strArray(lngCounter) = strArray(lngCounter - 1)               'Move the current array string data to the next array number
  579.             strArray(lngCounter - 1) = vbNullString        'Insert a Blank line
  580.         End If
  581.  
  582.         lngSequentialCRLF = 0
  583.     End If
  584.  
  585. End Sub
  586.  
  587. Private Sub cmdClear_Click()
  588.  
  589.     txtEnterComments.Text = vbNullString
  590.     txtEnterComments.SetFocus
  591.  
  592. End Sub
  593.  
  594. Private Sub cmdCopy_Click()
  595.  
  596.     With txtEnterComments
  597.         .SetFocus
  598.         .SelStart = 0
  599.         .SelLength = Len(.Text)
  600.     End With
  601.  
  602.     Clipboard.Clear
  603.     Clipboard.SetText txtEnterComments.SelText
  604.  
  605. End Sub
  606.  
  607. Private Sub cmdFormat_Click()
  608.  
  609. Dim lngCRLF     As Long
  610. Dim lngLoop1    As Long
  611. Dim strComments As String
  612. Dim strCopy     As String
  613. '
  614. '   *************************************************************************
  615. '   ****                                                                 ****
  616. '   ****    The user clicked the "Format" button.                        ****
  617. '   ****                                                                 ****
  618. '   *************************************************************************
  619. '
  620.     ReDim strArray(0 To 999) As String      'Clear the Array
  621. '   Store the Format Bars
  622.     strTopFormatBar = txtTopBotFormat.Text
  623.     strSideFormatBar = txtSideFormat.Text
  624.  
  625.     GetFormatBarInfo
  626.  
  627. '   "lngFieldSize" is the length of a string that will fit exactly between the "*" Borders.
  628.     lngFieldSize = InStrRev(strSideFormatBar, " ", , vbTextCompare) - lngBorderEnd - (lngSpaces * 2)
  629. '
  630. '   *************************************************************************
  631. '   ****                                                                 ****
  632. '   ****    Clean any blank lines or spaces off the back of the text.    ****
  633. '   ****                                                                 ****
  634. '   *************************************************************************
  635. '
  636.     strComments = Trim$(txtEnterComments.Text)             'Trim any Spaces off the front and back of the string.
  637.     lngCRLF = 1              'Make sure we go through the While/Wend at least once
  638.     lngCounter = Len(strComments) - 1       'Where to start searching strComments for a CR/LF
  639.  
  640.     Do While lngCRLF > 0
  641.         lngCRLF = InStr(lngCounter, strComments, vbNewLine, vbTextCompare)               'Check the end of the string for a CR/LF
  642.         If lngCRLF > 0 Then
  643.             strComments = Trim$(Left$(strComments, lngCounter - 1))       'Trim any Spaces and CR/LF off the back of the string.
  644.             lngCounter = Len(strComments) - 1              'Where to start searching strComments for a CR/LF
  645.         End If
  646.     Loop
  647.  
  648.     strComments = Trim$(strComments) & vbNewLine           'Make sure that there are no Spaces at the end of the string.
  649.     lngCounter = 0           'Clear the array Counter
  650.     lngSequentialCRLF = 0
  651.  
  652. strCheck_It:
  653. '
  654. '   *************************************************************************
  655. '   ****                                                                 ****
  656. '   ****    Break the Text string down into individual sentences.        ****
  657. '   ****                                                                 ****
  658. '   *************************************************************************
  659. '
  660.     lngCRLF = InStr(1, strComments, vbLf, vbTextCompare)   'Check the string for a CR/LF
  661.  
  662.     If lngCRLF > 0 Then
  663.         lngCounter = lngCounter + 1         'This will be the number of the current array string
  664.         strArray(lngCounter) = Left$(strComments, lngCRLF - 2)            'Fill the array string up to the 1st line feed
  665.         strCopy = Trim$(Mid$(strComments, lngCRLF + 1, 9999))             'Chop the CR/LF off the end of the string
  666.     End If
  667.  
  668.     BreakerBar
  669.  
  670. '   Reset the string so we can continue checking it.
  671.     If Len(strCopy) > 0 Then
  672.         strComments = strCopy
  673.         GoTo strCheck_It
  674.     End If
  675.  
  676. '   If the last line is a Breaker, delete it.
  677.     If strArray(lngCounter) = "Place a BreakerBar here!" Then
  678.         strArray(lngCounter) = vbNullString
  679.         lngCounter = lngCounter - 1
  680.     End If
  681. '
  682. '   *************************************************************************
  683. '   ****                                                                 ****
  684. '   ****    Display the Formatted Comments.                              ****
  685. '   ****                                                                 ****
  686. '   *************************************************************************
  687. '
  688.     txtEnterComments.Text = vbNewLine & "'"
  689.  
  690.     If txtTopBotBars.Text > 0 Then
  691.         For lngLoop1 = 1 To txtTopBotBars.Text             'Print the Top Border
  692.             txtEnterComments.Text = txtEnterComments.Text & vbNewLine & strTopFormatBar
  693.         Next lngLoop1
  694.     End If
  695.  
  696.     txtEnterComments.Text = txtEnterComments.Text & vbNewLine & strSideFormatBar
  697. '
  698. '   *************************************************************************
  699. '   ****                                                                 ****
  700. '   ****    Break the text into strings that are 53 characters long.     ****
  701. '   ****    Note: This number will change depending on the format        ****
  702. '   ****    entered by the user.                                         ****
  703. '   ****                                                                 ****
  704. '   *************************************************************************
  705. '
  706.     For lngLoop1 = 1 To lngCounter
  707.         strComments = Trim$(strArray(lngLoop1))            'strComments is the current comment
  708.  
  709.         If LenB(strComments) = 0 Then
  710.             strBreakerBar = vbNullString
  711.             GoTo PadTheString
  712.         End If
  713.  
  714.         Do While Len(strComments) > 0
  715.             strBreakerBar = Trim$(Left$(strComments, lngFieldSize + 1))   'strBreakerBar is the current comment segment
  716.  
  717.             If Len(strBreakerBar) < lngFieldSize + 1 Then
  718.                 lngLoop2 = Len(strBreakerBar) + 1
  719.                 GoTo PadTheString
  720.             End If
  721.  
  722.             For lngLoop2 = Len(strBreakerBar) To 1 Step -1 'Start at the back of the line
  723.                 If Mid$(strBreakerBar, lngLoop2, 1) = " " Then            'Look for the first " " (Space character)
  724.                     Exit For 'When you find it, exit the loop
  725.                 End If
  726.             Next lngLoop2
  727.  
  728. PadTheString:
  729.             If lngLoop2 = 0 Then
  730.                 lngLoop2 = lngFieldSize + 1
  731.             End If
  732.  
  733.             PadLine
  734.  
  735.             strComments = Trim$(Mid$(strComments, lngLoop2, 9999))        'strComments is the remainder of the comment
  736.         Loop
  737.     Next lngLoop1
  738. '
  739. '   *************************************************************************
  740. '   ****                                                                 ****
  741. '   ****    Print the end lines out to the temporary file.               ****
  742. '   ****                                                                 ****
  743. '   *************************************************************************
  744. '
  745.     txtEnterComments.Text = txtEnterComments.Text & vbNewLine & strSideFormatBar
  746.  
  747.     If txtTopBotBars.Text > 0 Then
  748.         For lngLoop1 = 1 To txtTopBotBars.Text             'Print the Top Border
  749.             txtEnterComments.Text = txtEnterComments.Text & vbNewLine & strTopFormatBar
  750.         Next lngLoop1
  751.     End If
  752.  
  753.     txtEnterComments.Text = txtEnterComments.Text & vbNewLine & "'"
  754.  
  755.     If chkLeftAlign.Value = 1 Then
  756.         txtEnterComments.Text = txtEnterComments.Text & vbNewLine & "'   RandyGrams Comments - Left Align the above comments."
  757.     End If
  758.  
  759. End Sub
  760.  
  761. Private Sub cmdRestoreText_Click()
  762.  
  763.     txtEnterComments.Text = strSave
  764.  
  765. End Sub
  766.  
  767. Private Sub cmdSaveText_Click()
  768.  
  769.     strSave = txtEnterComments.Text
  770.  
  771. End Sub
  772.  
  773. Private Sub Form_Initialize()
  774.  
  775.     InitCommonControls
  776.  
  777. End Sub
  778.  
  779. Private Sub Form_Load()
  780.  
  781. '   Store the Default Format Bars
  782.     strTopFormatBar = "'   *************************************************************************"
  783.     strSideFormatBar = "'   ****                                                                 ****"
  784.  
  785.     GetFormatBarInfo
  786.  
  787. '   Get the Screen Width
  788.     lngScreenWide = GetSystemMetrics(SM_CXSCREEN)
  789. '   Maximize the Form
  790.     Me.Move 0, 0, Screen.Width, Screen.Height
  791. '   Display a Sample
  792.     txtEnterComments.Text = "This is an example of what your Formatted comments would look like with the current setup." & _
  793.                              vbNewLine & vbNewLine & "Press 'Clear', enter your comments here, then press the 'Format!' button."
  794.     cmdFormat_Click
  795.  
  796. End Sub
  797.  
  798. Private Sub Form_Resize()
  799.  
  800. '   The dark Frame at the top of the screen.
  801.     With picTopBotFrame
  802.         .Move 0, 0, Me.ScaleWidth, txtTopBotFormat.Height + picTopBotBars.Height + txtSideFormat.Height + 40
  803. '       The Format bar at the top of the screen w/Blue text.
  804.         txtTopBotFormat.Move 10, 10, .Width - 20
  805.     End With  'picTopBotFormat
  806.  
  807. '   The Picture Frame containing the number of Top and Bottom Border Bars.
  808.     With picTopBotBars
  809. '       The Label with the number of Top and Bottom Border lines.
  810.         lblTopBotBars.Move 5, 9
  811. '       The Picture Frame containing the number of Top and Bottom Border Bars.
  812.         .Move txtTopBotFormat.Left, txtTopBotFormat.Top + txtTopBotFormat.Height + 10, ((Me.ScaleWidth - lblTopBotFormat.Width) \ 2) - 40
  813. '       The Text Box with the number of Top and Bottom Border lines.
  814.         txtTopBotBars.Move .Width - 60, 5, 50, lblTopBotBars.Height
  815.     End With  'picTopBotBars
  816.  
  817.     With picNumSpaces
  818. '       The Picture Frame containing the number of spaces.
  819.         .Move txtTopBotFormat.Left + txtTopBotFormat.Width - picTopBotBars.Width, picTopBotBars.Top, picTopBotBars.Width, picTopBotBars.Height
  820. '       The Label with the number of Spaces.
  821.         lblNumSpaces.Move 5, 3
  822. '       The Text Box with the number of Spaces
  823.         txtNumSpaces.Move .Width - 60, 5, 50, lblNumSpaces.Height
  824.     End With  'picNumSpaces
  825.  
  826.     If lngScreenWide < 1100 Then
  827.         With lblTopBotFormat
  828.             .FontBold = False
  829.             .FontSize = 10
  830.             .Height = 17
  831.             .Width = 320
  832.         End With             'lblTopBotFormat
  833.  
  834.         With lblSideFormat
  835.             .FontBold = False
  836.             .FontSize = 10
  837.             .Height = 17
  838.             .Width = 320
  839.         End With             'lblSideFormat
  840.     End If
  841.  
  842. '   The info label line near the top of the screen.
  843.     lblTopBotFormat.Move (Me.ScaleWidth - lblTopBotFormat.Width) \ 2, picTopBotBars.Top
  844. '   The Label w/the format for the sides of the text box.
  845.     lblSideFormat.Move lblTopBotFormat.Left, picTopBotBars.Top + picTopBotBars.Height - lblTopBotFormat.Height
  846.  
  847. '   The Text Box w/the format for the sides of the text box.
  848.     txtSideFormat.Move txtTopBotFormat.Left, picTopBotBars.Top + picTopBotBars.Height + 10, txtTopBotFormat.Width
  849. '   The Picture Frame containing the Command Boxes.
  850.     picCommandBar.Move txtTopBotFormat.Left, picTopBotFrame.Top + picTopBotFrame.Height, txtTopBotFormat.Width
  851.  
  852. '   The "Clear" Key
  853.     With cmdClear
  854.         .Move 0, 0, picCommandBar.Width \ 5
  855. '       The "Format" Key
  856.         cmdFormat.Move .Left + .Width, 0, .Width
  857. '       The "Copy" Key
  858.         cmdCopy.Move cmdFormat.Left + .Width, 0, .Width
  859. '       The "Save Text" Key
  860.         cmdSaveText.Move cmdCopy.Left + .Width, 0, .Width
  861. '       The "Restore Text" Key
  862.         cmdRestoreText.Move cmdSaveText.Left + .Width, 0, .Width, 58
  863. '   The Picture Frame containing the Rich Text Box.
  864.     End With  'cmdClear
  865.  
  866. '   The Picture Frame containing the Rich Text Box.
  867.     picEnterComments.Move picTopBotFrame.Left, picCommandBar.Top + picCommandBar.Height, picTopBotFrame.Width, Me.ScaleHeight - picCommandBar.Top - picCommandBar.Height
  868.     chkLeftAlign.Move cmdRestoreText.Left + (cmdRestoreText.Width \ 2) - 132, 2
  869.     lblEnterComments.Move lblTopBotFormat.Left, 5, lblTopBotFormat.Width, lblTopBotFormat.Height
  870. '   The Rich Text Box where the input & output are displayed
  871.     txtEnterComments.Move txtTopBotFormat.Left, lblEnterComments.Top + lblEnterComments.Height + 5, txtTopBotFormat.Width, picEnterComments.Height - txtEnterComments.Top - 10
  872.  
  873. End Sub
  874.  
  875. Private Sub Form_Unload(Cancel As Integer)
  876.  
  877.     Close
  878.     End
  879.  
  880. End Sub
  881.  
  882. Private Sub GetFormatBarInfo()
  883.  
  884. '   Determine the proper spacing and line length
  885.     lngSpaces = txtNumSpaces.Text           'The number of spaces between the Border and the Text.
  886. '   The last Space character before the Right Border.
  887.     lngFieldEnd = InStrRev(strSideFormatBar, " ", -1, vbTextCompare)
  888. '   The rightmost character of the Left Border.
  889.     lngBorderEnd = InStr(1, strSideFormatBar, Space$(20), vbTextCompare) - 1
  890. '   The Width of the Asterisk Border.
  891.     lngLeftBorder = lngBorderEnd - lngSpaces
  892.  
  893. End Sub
  894.  
  895. Private Sub lblEnterComments_Click()
  896.  
  897. '   Move the Focus to the Text Box
  898.     txtEnterComments.SetFocus
  899.  
  900. End Sub
  901.  
  902. Private Sub lblNumSpaces_Click()
  903.  
  904.     txtNumSpaces.SetFocus
  905.  
  906. End Sub
  907.  
  908. Private Sub lblTopBotBars_Click()
  909.  
  910.     txtTopBotBars.SetFocus
  911.  
  912. End Sub
  913.  
  914. Private Sub mnuAbout_Click()
  915.  
  916.     RG_About.Show vbModal, Me
  917.  
  918. End Sub
  919.  
  920. Private Sub mnuEditCopy_Click()
  921.  
  922.     Clipboard.Clear
  923.     Clipboard.SetText txtEnterComments.SelText
  924.  
  925. End Sub
  926.  
  927. Private Sub mnuEditCut_Click()
  928.  
  929.     Clipboard.SetText txtEnterComments.SelText
  930.     txtEnterComments.SelText = vbNullString
  931.  
  932. End Sub
  933.  
  934. Private Sub mnuEditPaste_Click()
  935.  
  936.     If Clipboard.GetFormat(vbCFText) Then
  937.         txtEnterComments.SelText = Clipboard.GetText
  938.     Else
  939.         MsgBox "Invalid Clipboard format."
  940.     End If
  941.  
  942. End Sub
  943.  
  944. Private Sub mnuEditSelectAll_Click()
  945.  
  946.     With txtEnterComments
  947.         .SetFocus
  948.         .SelStart = 0
  949.         .SelLength = Len(.Text)
  950.     End With
  951.  
  952. End Sub
  953.  
  954. Private Sub mnuFileNew_Click()
  955.  
  956.     txtEnterComments.Text = vbNullString
  957.     strOpenFile = vbNullString
  958.  
  959. End Sub
  960.  
  961. Private Sub mnuFileOpen_Click()
  962.  
  963. Dim lngFN1                   As Long
  964.  
  965.     On Error GoTo FileError
  966.     With CDB
  967.         .CancelError = True
  968.         .Flags = cdlOFNFileMustExist
  969.         .DefaultExt = "TXT"
  970.         .Filter = "Text files|*.TXT|All files|*.*"
  971.         .ShowOpen
  972.         lngFN1 = FreeFile
  973.         Open .FileName For Input As #lngFN1
  974.     End With
  975.  
  976.     txtEnterComments.Text = Input$(LOF(lngFN1), #lngFN1)
  977.     Close #lngFN1
  978.     strOpenFile = CDB.FileName
  979.  
  980. Exit Sub
  981.  
  982. FileError:
  983.     If Not Err.Number = cdlCancel Then
  984.         MsgBox "Unkown error while opening file " & CDB.FileName
  985.         strOpenFile = vbNullString
  986.     End If
  987.  
  988. End Sub
  989.  
  990. Private Sub mnuFileSave_Click()
  991.  
  992. Dim lngFN1                   As Long
  993.  
  994.     If LenB(strOpenFile) = 0 Then
  995.         mnuFileSaveAs_Click
  996.     Else
  997.         On Error GoTo FileError
  998.         lngFN1 = FreeFile
  999.         Open strOpenFile For Output As #lngFN1
  1000.         Print #lngFN1, txtEnterComments.Text
  1001.         Close #lngFN1
  1002.  
  1003.         GoTo Leave
  1004.  
  1005. FileError:
  1006.         If Err.Number <> cdlCancel Then
  1007.             MsgBox "Unkown error while saving file " & strOpenFile
  1008.             strOpenFile = vbNullString
  1009.         End If
  1010.     End If
  1011.  
  1012. Leave:
  1013.  
  1014. End Sub
  1015.  
  1016. Private Sub mnuFileSaveAs_Click()
  1017.  
  1018. Dim lngFN1                   As Long
  1019.  
  1020.     On Error GoTo FileError
  1021.     With CDB
  1022.         .CancelError = True
  1023.         .Flags = cdlOFNOverwritePrompt
  1024.         .DefaultExt = "TXT"
  1025.         .Filter = "Text files|*.TXT|All files|*.*"
  1026.         .ShowSave
  1027.  
  1028.         lngFN1 = FreeFile
  1029.         Open .FileName For Output As #lngFN1
  1030.     End With
  1031.  
  1032.     Print #lngFN1, txtEnterComments.Text
  1033.     Close #lngFN1
  1034.  
  1035.     strOpenFile = CDB.FileName
  1036.  
  1037. Exit Sub
  1038.  
  1039. FileError:
  1040.     If Not Err.Number = cdlCancel Then
  1041.  
  1042.         MsgBox "Unkown error while saving file " & CDB.FileName
  1043.         strOpenFile = vbNullString
  1044.  
  1045.     End If
  1046.  
  1047. End Sub
  1048.  
  1049. Private Sub mnuHelp_Click()
  1050. '
  1051. '   *************************************************************************
  1052. '   ****                                                                 ****
  1053. '   ****    Display the 'Help' page.                                     ****
  1054. '   ****                                                                 ****
  1055. '   ****    This is from a suggestion by:  Rob C.                        ****
  1056. '   ****                                                                 ****
  1057. '   ****    Thank you Rob C.                                             ****
  1058. '   ****                                                                 ****
  1059. '   *************************************************************************
  1060. '
  1061.     ShellExecute Me.hwnd, "open", App.Path & "\Formatter.Html", vbNullString, vbNullString, SW_MAXIMIZE
  1062.  
  1063. End Sub
  1064.  
  1065. Private Sub mnuQuit_Click()
  1066.  
  1067.     Unload Me
  1068.     End
  1069.  
  1070. End Sub
  1071.  
  1072. Private Sub mnuSample_Click()
  1073.  
  1074. Dim lngFN1                   As Long
  1075.  
  1076.     lngFN1 = FreeFile
  1077.     lngCounter = 0
  1078.  
  1079.     Open App.Path & "\Format.ter" For Input As #lngFN1
  1080.     txtEnterComments.Text = Input$(LOF(lngFN1), #lngFN1)
  1081.     Close #lngFN1
  1082.  
  1083. End Sub
  1084.  
  1085. Private Sub mnuUnFormat_Click()
  1086.  
  1087. Dim blnCheck    As Boolean
  1088. Dim lngFN1      As Long
  1089. Dim lngInStr    As Long
  1090. Dim lngLoop     As Long
  1091. Dim strArray()  As String
  1092. Dim strUnFormat As String
  1093.  
  1094.     lngFN1 = FreeFile
  1095.     Open App.Path & "\T.emp" For Output As #lngFN1
  1096.         Print #lngFN1, txtEnterComments.Text
  1097.     Close #lngFN1
  1098.  
  1099.     txtEnterComments.Text = vbNullString
  1100.     lngFN1 = FreeFile
  1101.     Open App.Path & "\T.emp" For Input As #lngFN1
  1102.  
  1103.     Do Until EOF(lngFN1)
  1104.         Line Input #lngFN1, strUnFormat
  1105. '       Remove any spaces from the front and back of the line.
  1106.         strUnFormat = Trim$(strUnFormat)
  1107. '       Look for the Tick Mark (') at the front of the line.
  1108.         lngInStr = InStr(1, strUnFormat, "'", vbTextCompare)
  1109.  
  1110.         If lngInStr < 1 Then
  1111.             GoTo Read_Next
  1112.         End If
  1113.  
  1114.         If Len(strUnFormat) > 0 Then
  1115. '           Remove the Tick Mark (') and any spaces from the front of the line.
  1116.             strUnFormat = Trim$(Mid$(strUnFormat, lngInStr + 1, Len(strUnFormat)))
  1117.         End If
  1118.  
  1119. '       This will handle a line that has 1 or more spaces before the "'".
  1120.         If Len(strUnFormat) = 0 Then
  1121.             GoTo Read_Next
  1122.         End If
  1123.  
  1124. '       Find the Asterisks (*) in the line.
  1125.         strArray = Split(strUnFormat, "*", , vbTextCompare)
  1126.  
  1127.         For lngLoop = 1 To UBound(strArray)
  1128.             strUnFormat = Trim(strArray(lngLoop))
  1129. '           Pull out only the stripped line.
  1130.             If Len(strUnFormat) > 0 Then
  1131.                 Exit For
  1132.             End If
  1133.         Next lngLoop
  1134.  
  1135.         If blnCheck = False Then
  1136.             If Len(strUnFormat) = 0 Then
  1137.                 GoTo Read_Next
  1138.             End If
  1139.  
  1140.             If Asc(Left$(strUnFormat, 1)) < 14 Then
  1141.                 GoTo Read_Next
  1142.             End If
  1143.         End If
  1144.  
  1145.         txtEnterComments.Text = txtEnterComments.Text & strUnFormat & vbNewLine
  1146.         blnCheck = True
  1147.         ReDim strArray(0)
  1148.  
  1149. Read_Next:
  1150.     Loop
  1151.  
  1152.     Close #lngFN1
  1153.     DeleteFile App.Path & "\T.emp"
  1154.     txtEnterComments.Text = Trim$(txtEnterComments.Text)
  1155.  
  1156. End Sub
  1157.  
  1158. Private Sub PadLine()
  1159.  
  1160. Dim strComments              As String
  1161. '
  1162. '   *************************************************************************
  1163. '   ****                                                                 ****
  1164. '   ****    This is where I insert all the asterisks "*" and spacing.    ****
  1165. '   ****    In other words, this is where I format your comments.        ****
  1166. '   ****                                                                 ****
  1167. '   *************************************************************************
  1168. '
  1169.     If strBreakerBar = "Place a BreakerBar here!" Then
  1170.         strComments = strTopFormatBar
  1171.         GoTo PrintLine
  1172.     End If
  1173.  
  1174. '   "strComments" is the comment broken at its last space character.
  1175. '   Then set to its formatted length.
  1176.     strComments = Left$(Left$(strSideFormatBar, lngBorderEnd + lngSpaces) & Left$(LTrim$(Left$(strBreakerBar, lngLoop2 - 1)) & Space$(lngFieldSize), lngFieldSize) & Space$(99), lngFieldEnd) & Right$(strSideFormatBar, Len(strSideFormatBar) - lngFieldEnd)
  1177.  
  1178. PrintLine:
  1179. '   This is the comment line w/all necessary padding
  1180.     txtEnterComments.Text = txtEnterComments.Text & vbNewLine & strComments
  1181.  
  1182. End Sub
  1183.  
  1184. Private Sub picNumSpaces_Click()
  1185.  
  1186.     txtNumSpaces.SetFocus
  1187.  
  1188. End Sub
  1189.  
  1190. Private Sub picTopBotBars_Click()
  1191.  
  1192.     txtTopBotBars.SetFocus
  1193.  
  1194. End Sub
  1195.  
  1196. Private Sub txtNumSpaces_Change()
  1197.  
  1198. '   Determine the proper spacing and line length
  1199.     lngSpaces = txtNumSpaces.Text           'The number of spaces between the Border and the Text.
  1200.  
  1201. End Sub
  1202.  
  1203. Private Sub txtSideFormat_Change()
  1204. '
  1205. '   *************************************************************************
  1206. '   ****                                                                 ****
  1207. '   ****    Make all of the Format Bars the same length.                 ****
  1208. '   ****                                                                 ****
  1209. '   *************************************************************************
  1210. '
  1211.     With txtSideFormat
  1212. '       This will limit the length of the Format Bars (currently500)
  1213.         If Len(.Text) > 500 Then
  1214.             .Text = Trim$(Left$(strSideFormatBar, 500))
  1215.         Else
  1216.             strSideFormatBar = .Text
  1217.         End If
  1218.  
  1219. '       Get some basic Format Bar Info.
  1220.         GetFormatBarInfo
  1221.  
  1222.         If Len(.Text) <> Len(txtTopBotFormat.Text) Then
  1223.             txtTopBotFormat.Text = Left$(Left$(.Text, InStr(1, .Text, Space$(20), vbTextCompare) - 1) & String$(Len(.Text), "*"), Len(.Text))
  1224.         End If
  1225.     End With  'txtSideFormat
  1226.  
  1227. End Sub
  1228.  
  1229. Private Sub txtTopBotFormat_Change()
  1230. '
  1231. '   *************************************************************************
  1232. '   ****                                                                 ****
  1233. '   ****    Make all of the Format Bars the same length.                 ****
  1234. '   ****                                                                 ****
  1235. '   *************************************************************************
  1236. '
  1237.     With txtTopBotFormat
  1238. '       This will limit the length of the Format Bars (currently 500)
  1239.         If Len(.Text) > 500 Then
  1240.             .Text = Trim$(Left$(strTopFormatBar, 500))
  1241.         Else
  1242.             strTopFormatBar = .Text
  1243.         End If
  1244.  
  1245.         If Len(.Text) <> Len(txtSideFormat.Text) Then
  1246.             txtSideFormat.Text = Left$("'" & Space$(lngSpaces - 1) & String$(lngLeftBorder, "*") & Space$(lngFieldEnd - lngBorderEnd) & String$(lngFieldEnd, "*"), Len(strTopFormatBar))
  1247.         End If
  1248.     End With  'txtTopBotFormat
  1249.  
  1250. End Sub
  1251.