Results 1 to 4 of 4
  1. #1
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dos Style Text Box (97 SR2)

    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. <img src=/S/help.gif border=0 alt=help width=23 height=15>

    Thanks!
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  2. #2
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Dos Style Text Box (97 SR2)

    Kel, <!post=This thread,184772>This thread<!/post> 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.
    <pre>Public Sub ProgressIndicator(iPerCent As Integer)
    lbIndicate.Width = iPerCent / 100 * lbFixed.Width

    DoEvents
    End Sub
    </pre>

    The incremental changes are launched from the code
    <pre>For i = 1 To ColCount - 1 Step 1
    'use number of columns to update progress message
    ProgressMsg2.ProgressIndicator (i / ColCount) * 100
    </pre>

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

    Cheers
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Dos Style Text Box (97 SR2)

    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

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


    During the process within loops or whatever add the line (at whatever interval is desired)
    <pre>'PctDone is Variable you create to calc the percent done.
    Application.StatusBar =format(PctDone, "0.0%") & " Percent Done."
    </pre>


    At the end of the code, reset the STATUSBAR
    <pre>'Turn it off
    Application.StatusBar = False
    Reset to whatever the User had it set on
    Application.DisplayStatusBar = bStatusState
    </pre>


    Steve

  4. #4
    3 Star Lounger
    Join Date
    Oct 2002
    Location
    Ross-on-Wye, Herefordshire, United Kingdom
    Posts
    212
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Dos Style Text Box (97 SR2)

    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

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •