Solved

Using a progress bar while running a routine

Posted on 2011-03-10
6
783 Views
Last Modified: 2012-08-14
I have done some research in the Knowledgebase and found a number of articles on progress bars such as the link below.  I am having trouble figuring out how to call a routine and have a progress bar display while the macro performs such as the prgress bar that is in the link below.  I have a macro that creates a csv file, saves this to a specified folder, then logs into a secure ftp server and saves the file on the server, then ends the routine.  The process takes approximately 20 seconds, however this could vary depending on internet connection speeds.  So I am really looking for a progress bar that will actually track the progress of the macro, if this is possible.

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/A_1756-A-VBA-Progress-Bar-for-Excel-and-Other-Microsoft-Apps.html?sfQueryTermInfo=1+10+30+excel+progressbar+vba

ID 1756
0
Comment
Question by:jlove88
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 23

Accepted Solution

by:
Michael Fowler earned 125 total points
ID: 35099759
The example provided relies on you setting the minimum and maximum values. In fact all progress bars rely on a coded guess as to how long the code will run. If you do not want to use an educated guess then you could just use the status bar to show that code is running and then a messagebox to indicate that the code has completed.

Michael
0
 
LVL 22

Assisted Solution

by:rspahitz
rspahitz earned 125 total points
ID: 35099761
Although there are some progress bar controls available for other things, there's nothing built in for Excel so you'll have to make your own (or load one from outside, which may require installing it if you share the workbook.)

What comes to mind is to open a UserForm with a simple label in it.  Inside the label you can add little pieces of text that represent the progress (like capital "i" or ".")
Every time you hit a certain point in the macro, you simply add another character to the label.
when you're done, you close the form from code.

Ideally, you will know how many times you'll hit the piece of code (like with a For/Next counter) or some other way to calculate the number of iterations so that you can put the right number of characters to fill the label when it completes.

Do you want to give this a try?
0
 
LVL 42

Assisted Solution

by:dlmille
dlmille earned 125 total points
ID: 35099911
I use the status bar for my progress.  If I have a loop I'm working through, I can determine % complete.

Inside the loop, say every 20 or 100 loops, I update the statusbar...

e.g.,

 
Sub testwStatusBar()
Dim i As Double

    For i = 0 To 500000
     If i Mod 1000 = 0 Then
        Application.StatusBar = "Running... -> " & Format(i / 500000, "0.00%") & " complete..."
     End If
    Next i
    
    Application.StatusBar = False

End Sub

Open in new window


Dave
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 45

Assisted Solution

by:patrickab
patrickab earned 125 total points
ID: 35115588
use the Status BAr to let you kno how th macro is progressing. it \doesn't interfere so much as a progress bar.

Patrick
0
 

Author Closing Comment

by:jlove88
ID: 35192484
All comments were useful however after playing around with the ideas, I decided not to use a progress bar.  I think it fair to divide the points equally and thank you for responding.
0
 
LVL 45

Expert Comment

by:patrickab
ID: 35193725
Points' divide is fine. A progress bar i good eye candy but thats' about all. stick with the Status bar and make it informative- that'll help a lot more
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question