Solved

Using a progress bar while running a routine

Posted on 2011-03-10
6
775 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:
Michael74 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

752 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