Flashbar

A Nanoscopic Notification Flashbar Animation for Excel

Version 1
16Oct 2016

Flashbar Documentation

By: Mark Kubiszyn




Here is a nanoscopic, animated Flashbar for Excel. You can use this animation to inform the user that you have just processed something. As an example, consider after Saving some data giving a quick Flash to the user would be indicative of a successful Save. The Flashbar dynamically creates and destroys a Shape Object, rendering a lovely little Bar across the top of the Worksheet that fades out as the animation ends. It has a subtle use as opposed to a Message Box which requires user interaction. This type of animation is widely used around the Internet as an indicator when loading Pages etc. I designed this for my Booking System Version 8 and use it upon Saving Booking data in the Calendar views

FEATURES

- Run a full-width Flash or a Progress type of animation to fit the Active Window or an Active Window Pane in a Worksheet
- Change the Bar Colour, Bar Height and Bar Width
- Tweak the Speed and Fade out settings for the Bar


REQUIRED

Excel 2010 or Excel 2013 (32bit or 64bit), working with Windows 7 & 10
Some knowledge of VBA to Copy & Paste Code into respective Code Modules in your own Projects

Configuring a Flashbar - A Handful of Simple Settings

Configuring the Flashbar is straightforward. Here is the Code to Initialise and Render a Red Flashbar animation with a Height of 3 in a Normal bar style, that fits the full width of the Worksheet:

 
 Public Bar As Flashbar
 Public intInterval As Integer

 
 Public Sub NormalFlashbar()

    If BarStep > Step Then Exit Sub

    Set Bar = New Flashbar

    Bar.Colour = rgbRed
    
    Bar.Height = 3

    Bar.Render

 End Sub
 
And here is the Code to Initialise and Render a Black Flashbar animation with a Height of 3 in a Progress bar style, that fits the full width of the Worksheet
 
 Public Bar As Flashbar
 Public intInterval As Integer

 
 Public Sub ProgressFlashbar()

    If BarStep > Step Then Exit Sub

    Set Bar = New Flashbar

    Bar.Colour = RGB(0, 0, 0)
    
    Bar.Height = 3

    Bar.BarType = Progress

    Bar.Render

 End Sub
 
Other settings include rendering the Flashbar in a Pane if you use the Freeze Panes option in Excel and setting the Bar width, so for example you could display a Flashbar in the second Pane with a width of 60. To make the Flashbar Modal (ie. stop user interaction while the Flashbar is running) you can also set the Modal property to True):
 
 Public Sub ProgressFlashbar()

 	Bar.PaneIndex = 2

    Bar.Width = 60

    Bar.Modal = True

 End Sub
 
Due to the fact that the Callback Subroutine must reside in a normal Code Module, I have added also added some editable settings at the top of the 'mdlFlashbar' Code Module that you can tweak. These include the Step (overall Speed of the Flashbar), the FadeStep (determines how quickly the Fade is applied to the Flashbar), the ProgressStep (used only for the Progress Style to increment the Bar Width as the Bar is rendered) and some Enum Colours to use for the Flashbar Bar Colour. Here are the settings:
 
' // the one and only Flashbar Class Object
Public Bar As Flashbar

' // used internally [do not edit]
Public BarStep As Integer

' // editable settings
'    Step.  1 is slowest.  default:=1
Private Const Step As Integer = 1

'    FadeStep.  tweak how the Flashbar fades out.  default:=25
Private Const FadeStep As Integer = 25

'    ProgressStep.  used only by a Progress style bar for the bar increment steps.  default:=150
Private Const ProgressStep As Integer = 150

' // Colour Enums
Private Enum RGBLongColour
    ' // default Flashbar Colours
    rgbBlack = 0
    rgbRed = 6184410
    rgbGreen = 4616993
End Enum
 

Copying the Code into Your Own Projects

To use the Flashbar in your own Projects, you can simply Copy the Code from the mdlFlashbar.bas and the Flashbar.cls into your own Excel Workbooks. You can also export and then re-import the Modules. The Flashbar is created dynamically and requires no Shape Objects.

To add from scratch, perform the following. Insert a new Class Module. Name the Class Flashbar and then Copy & Paste in all of the Code for the Class Module from the Downloaded Flashbar.xlsm Workbook. Then Copy the Code at the beginning of the mdlFlashbar into your own Code Module (not a Class Module) remembering to include the 2 Public Variables. Copy the Callback Subroutine into the same Module and you are good to go! Configure a Flashbar as per the Code examples above. When you have purchased you can receive support by contacting me on the Email address with which you purchased the Product - contact details are provided following the download.

Q&A

Q. Is this a progress bar?
A. No, this is an animation on a timer that you can run to inform the user that Excel has 'just done' a Task ie. Saving some data...

CHANGELOG

16.10.2016 - (Version 1) released