+ Reply to Thread
Results 1 to 5 of 5

Custom Dialog box

  1. #1
    Registered User
    Join Date
    09-08-2010
    Location
    san jose
    MS-Off Ver
    Excel 2007
    Posts
    5

    Wink Custom Dialog box

    hello all,
    i was wondering if there was a way to code a VBA script to create a dialog box to display a label and a cancel button. the cancel button does what it should by closing the box, but what i would like the label to do is rotate text values. so it may say...

    "compiling Data"
    and then a few seconds later say
    "analyzing Values"

    and so on and so forth. it really doesnt have anything to do with the worksheet.
    but i wanted somethin to sorta just "look" like it was chgging away.
    any ideas?

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,332

    Re: Custom Dialog box help

    Sounds like you want a progress bar? There are hundreds of examples available (quick Search required). I think Andy (Pope) may have one on his site.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Custom Dialog box help

    I've used a listbox on a userform, adding a line at intervals as the code progresses. I'll add an example this evening
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    09-08-2010
    Location
    san jose
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Custom Dialog box help

    hey all, ok so i got some of it worked out, now the issue seems to be that when i use the cancel button everything closes like it should, but two things happen. 1. my system slows to a crawl afterwards. so i expect that i need to add some sort of memory dump? and 2. when i activate the process again, it just sorta picks up from where it left off instead of starting over.

    anyways heres all my code.


    Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)


    Private Sub cmdCancel_Click()
    Me.Tag = 0
    Me.Hide
    End Sub

    Private Sub UserForm_Task(Cancel As Integer, CloseMode As Integer)
    Call Main
    If CloseMode = vbFormControlMenu Then Cancel = True
    End Sub






    Sub UpdateMessage(msgnum)
    DoEvents
    Select Case msgnum

    Case 1
    Task.TextBox1.Value = "Collecting Values..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 2
    Task.TextBox1.Value = "Searching Source Data..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 3
    Task.TextBox1.Value = "Shovelling coal into the server..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 4
    Task.TextBox1.Value = "Enabeling OpenFeint Server..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 5
    Task.TextBox1.Value = "Compiling Data..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 6
    Task.TextBox1.Value = "Are we there yet?..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 7
    Task.TextBox1.Value = "Updating Account Information..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 8
    Task.TextBox1.Value = "Dumping unused information..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 9
    Task.TextBox1.Value = "Performing Vlookup process..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 10
    Task.TextBox1.Value = "Checking the gravitational constant..."
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    Case 11
    Task.TextBox1.Value = "Verifying Data... Reload Required"
    Task.TextBox1.SetFocus
    Task.ActiveControl.SetFocus
    End Select
    End Sub

    Private Sub CommandMe_Click()

    Sleep (2000)
    UpdateMessage (1)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (2)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (3)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (4)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (5)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (6)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (7)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (8)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (9)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (10)
    Task.ProgressBar1.Value = 0
    Sleep (500)
    Task.ProgressBar1.Value = 25
    Sleep (500)
    Task.ProgressBar1.Value = 50
    Sleep (500)
    Task.ProgressBar1.Value = 75
    Sleep (500)
    Task.ProgressBar1.Value = 100
    UpdateMessage (11)

    Call CommandMe_Click

    End Sub

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Custom Dialog box

    Please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1