• Dos Style Text Box (97 SR2)

    Author
    Topic
    #377762

    I have a basic idea of how this might be done, but hopefully the insight provided here can give me a good method of solidifying the results.

    What i’d like to do is create a text-box that is regularly fed status updates for a lengthy process. I know that I can disable the scroll bars on a text-box, but my question is, how can I keep the focus on any items currently being added by the process? If I use the following:

    Sub NoteWorthy()
    tbStatusUpdate.value = tbStatusUpdate.value + “Some Added Status Here.”
    End Sub

    It’ll add tons of stuff to the box, but it drops everything at the bottom, out of visual range. help

    Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #623048

      Kel, This thread a while back talked about updating a user form.

      I use something like this in form code to show a bar updating as a lengthy process goes on.

      Public Sub ProgressIndicator(iPerCent As Integer)
          lbIndicate.Width = iPerCent / 100 * lbFixed.Width
      
          DoEvents
      End Sub
      

      The incremental changes are launched from the code

      For i = 1 To ColCount - 1 Step 1
          'use number of columns to update progress message
             ProgressMsg2.ProgressIndicator (i / ColCount) * 100
      

      As you might guess, the form is called ProgressMsg2
      Is this what you had in mind?

      Cheers

      • #623050

        Hi Folks

        Found this web link on another post earlier, seems to have working examples of the kind of thing you are discussing:

        http://www.bmsltd.ie/Excel/Default.htm%5B/url%5D

        Specifically…

        WksPrgrs.zip (16 Nov 1996, 23k, 11041 downloads)
        This file contains a VBA routine to draw a ‘modeless’ dialog box to the Excel window. The dialog box contains a percentage-complete progress bar, which runs for example while a routine is completing. It works by directly drawing and writing to the Excel window, using Windows API calls. Includes versions for both Excel 5 (using 16-bit API calls) and Excel 7 (using 32-bit calls).

        But there does seem to be lots of good stuff there.

        Regards
        Peter

        Edited Mar 13th 2004 to update link

        • #623058

          Instead of progress charts, you can use the STATUSBAR at the bottom left of excel sheet, to update the user:
          At the beginning of your code have

          'Store user's current state
              bStatusState = Application.DisplayStatusBar   
          'Turn on the indicator
              Application.DisplayStatusBar = True                 
          

          During the process within loops or whatever add the line (at whatever interval is desired)

          'PctDone is Variable you create to calc the percent done.
          Application.StatusBar =format(PctDone, "0.0%") & " Percent Done." 
          

          At the end of the code, reset the STATUSBAR

          'Turn it off
          Application.StatusBar = False
          Reset to whatever the User had it set on
          Application.DisplayStatusBar = bStatusState
          

          Steve

    Viewing 0 reply threads
    Reply To: Dos Style Text Box (97 SR2)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: