Skip to content

cristianbuse/Excel-VBA-ProgressBar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Excel-VBA-ProgressBar

Flexible Progress Bar for Excel

gif

Related Code Review question

The Progress Bar from this project has the following features:

  • Works on both Windows and Mac
  • The user can cancel the displayed form via the X button (or the Esc key), if the AllowCancel property is set to True
  • The form displayed can be Modal but also Modeless, as needed (see ShowType property)
  • The progress bar calls a 'worker' routine which:
    • can return a value if it's a Function
    • accepts a variable number of parameters and can change them ByRef if needed
    • can accept the progress bar instance at a specific position in the parameter list but not required
    • can be a macro in a workbook (see RunMacro ) or a method on an object (see RunObjMethod)
  • Has the ability to show how much time has elapsed and an approximation of how much time is left if the ShowTime property is set to True
  • The userform module has a minimum of code (just events that are going to get raised) and has no design time controls which makes it easily reproducible

Installation

Just import the following code modules in your VBA Project:

  • ProgressBar.cls
  • ProgressForm.frm (you will also need the ProgressForm.frx when you import) - Alternatively, this can be easily recreated from scratch in 3 easy steps:
    1. insert new form
    2. rename it to ProgressForm
    3. add the following code:
      Option Explicit
      
      Public Event Activate()
      Public Event QueryClose(Cancel As Integer, CloseMode As Integer)
      
      Private Sub UserForm_Activate()
          RaiseEvent Activate
      End Sub
      Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
          RaiseEvent QueryClose(Cancel, CloseMode)
      End Sub

Demo

Import the following code modules:

There is also a Demo Workbook available for download.

License

MIT License

Copyright (c) 2022 Ion Cristian Buse

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Flexible Progress Bar for Excel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages