Introduction

Introducing Lightbox - 3 different methods to Creating a Lightbox (with easing) and an Access example

An Abstract Class demonstrating a configurable Lightbox Overlay, a minified dynamic UserForm Class and a single Lightbox UserForm Class for Excel 2013 & 2016 Version 16.0 (32bit or 64bit) designed for Windows 11

Lightbox v1

A Lightbox is a Light or Dark overlay that covers the entire Application Window. Version 1, Lightbox Class features some abstraction, based around a Class example by Rubberduck whereby you do not neccesarily need to ever Unload a UserForm in order for it to go out of Scope. The UserForm implements an IFoo Class and IWrapper Class to pass the UserForm as an Object. Retro-fit for Windows 11 fix for rounded corners & resized Windows

Prerequisites

  • Excel 2013-2016, (32bit & 64bit)
  • Basic Excel skills. Basic to moderate VBA Skills
  • Windows PC · NOT a Mac!

Features

  • 3 Calls, Init(), Go() and Kill()
  • Quick, smooth configurable Lightbox overlay effect
  • Change the Colour and Opacity of the Lightbox from 0-255

Lightbox v2

Lightbox version 2, consists of just 3 minified Classes that create a dynamic Borderless UserForm with easing and Transparency. It will instantiate a UserForm with the following Methods: Show(), TransitionIn() and TransitionOut(). It allows proprietary access (without intellisense) to Properties such as Width, Height, StartUpPosition via the PseudoInterface Property of the Foobar Class. It then uses the Transition Methods to Fade the Lightbox overlay in and out on a Timer together with easing Functions. Retro-fit for Windows 11 fix for rounded corners & resized Windows

Prerequisites

  • Excel 2013-2016, (32bit & 64bit)
  • Basic Excel skills. Basic to moderate VBA Skills
  • Windows PC · NOT a Mac!

Features

  • 3 Minified Classes, SystemMetric, Easing and Foobar
  • 3 Methods, Show(), TransitionIn() and TransitionOut()
  • Proprietary access (without intellisense) to Properties such as Width, Height, StartUpPosition via the PseudoInterface Property of the Foobar Class
  • Change the Colour and Opacity of the Lightbox from 0-255
  • Silky smooth animation
  • Use one of 20+ easing Functions to Fade the Lightbox in and out

Lightbox v3

Lightbox version 3 is a single UserForm Code Module that encapsulates most of the Code for version 2 but it doesn't create a dynamic UserForm for the Lightbox, it is, in essence the Lightbox itself. It is a lot more easier to implement and understand. Simply drag the Code Module across to your Project and you are good to go! This version still allows easing and has the advanced Timer functionality of version 2. This is also the version that is used for the Access example included in the download. Retro-fit for Windows 11 fix for rounded corners & resized Windows

Prerequisites

  • Excel & Access 2013-2016, (32bit & 64bit)
  • Basic Excel skills. Basic to moderate VBA Skills
  • Windows PC · NOT a Mac!

Features

  • 1 UserForm Code Module containing all of the Code
  • 2 Methods, FadeIn() and FadeOut()
  • Change the Colour and Opacity of the Lightbox from 0-255
  • Silky smooth animation
  • Overlay another Modal UserForm ontop of the Lightbox - when the user dismisses the UserForm, the Ligthbox will close (see the Image below of my Bug Error UserForm)
  • Use one of 20+ easing Functions to Fade the Lightbox in and out
  • Both Excel & Access Examples included in the Zip File
  • Works with Windows 11 OS




Installation

Lightbox.zip is ready to use. Right-click, extract to unzip the Files to your PC. Open any version of Lightbox and test out the Demos. To view the Code behind the Lightbox Demos, click 'View Code' (you will need to enable Macros)

For version 1, it is encouraged that you build you Project around Lightbox, however, merely copy in the UserForms and Class Code Modules in the Explorer Window to your Project and wrap an example around your task

For version 2 you only need to copy 3 small Classes and you are good to go

For version 3, you just need to copy the UserForm Code Module called Lightbox and that's it. To use the Access version you will need Microsoft Access - open the File and test out the Examples

Usage

Lightbox Version 1

  • Lightbox.Init will initialise the Lightbox
  • Lightbox.Go will run the Lightbox animation
  • Your Task goes here...

  • Lightbox.Kill will terminate the Lightbox

Lightbox has some configurable Class Members (Any Lightbox settings ie. Colour and Opacity must be made prior to a Go() Call):

  • Lightbox.LightboxColour = vbWhite
  • Lightbox.LightboxOpacity = 100

More Information

Please Note: these Parameters are not passed in the 3 Subroutine Calls
For the LightboxColour member you can use vbWhite, vbBlack, RGB(255, 255, 255) or a long value, 5324346. The LightboxOpacity member can be 0-255 with 0 being totally transparent and 255 being a Solid Fill



Lightbox Version 2

  • Dim Lightbox As Foobar
  • Set Lightbox = New Foobar will instantiate the UserForm

  • Lightbox.TransitionIn Modal:=False, Placement:=FitToExcel, EasingFunction:=easeInSine, Opacity:=180, Colour:=vbWhite, NumberOfTweens:=12, TweensPerSecond:=50 will fade in the Lightbox
  • Your Task goes here...

  • Lightbox.TransitionOut EasingFunction:=easeInSine, Opacity:=180, Colour:=vbWhite, NumberOfTweens:=12, TweensPerSecond:=50 will fade out the Lightbox

Lightbox has proprietary Methods and Properties that you can access via the PseudoInterface Property of the Foobar Class (make these calls before using Show() or TransitionIn()):

  • Lightbox.PseudoInterface.Width = 300
  • Lightbox.PseudoInterface.Height = 200
  • Lightbox.PseudoInterface.StartUpPosition = 0
  • etc. (any normal members of a UserForm Class can be accessed here)

More Information

Version 2 has lots more configurable elements, especially around the timing and the easing Functions that you can use for the Fade in/out. For the Colour you can use any of the following parameters: vbBlack, RGB(34, 34, 34), 16777215 etc. For the easing Functions you can use one of these:

easeBackInCubic
easeBackInQuartic
easeInBack
easeInCirc
easeInCubic
easeInExpo
easeInOutCubic
easeInOutQuintic
easeInQuad
easeInQuadratic
easeInQuart
easeInQuartic
easeInQuintic
easeInSine
easeLinear
easeOutBack
easeOutBounce
easeOutElastic
easeOutInCubic
easeOutInQuartic
easeOutQuad
easeOutQuartic
easeOutQuintic
easeOutSine

Lightbox v2 also implements a .Show() Method in the Foobar Class which overrides the normal .Show() for a UserForm and allows you to specify a True or False values for Modal as opposed to a long Enum for vbModal or vbModeless



Lightbox Version 3

  • Lightbox.FadeIn False, FitToExcel, easeOutSine will Fade in the Lightbox
  • Your Task goes here...

  • Lightbox.FadeOut easeOutSine will Fade out the Lightbox

More Information

Lightbox v3 only really uses 2 Methods, FadeIn() and FadeOut(). Both of these are inside the Lightbox UserForm. The Parameters are similar to version 2 and include Modal:=True/False, Placement:=FitToExcel/FitToScreen, EasingFunction:=(one of the 24 easings shown above for version 2), Opacity:=120 (a measure of Fill form 0 to 255 with 255 being completely solid), Colour:=0/RGB(34, 34, 34),vbBlack etc., NumberOfTweens:=12 (the number of Tweens, which will be the number of easing values returned, positive only from 0 to Opacity), TweensPerSecond:=50 (1/50=0.02, 20 milliseconds between Tweens)

FAQ

Q. I am a novice VBA user and there are so many Lightbox examples - which one should I use?
A. Use Version 3. In Version 3.1 I have added more examples of using the Lightbox with another UserForm - it's by far the easiest of the 3 Lightboxes in this Project to implement



Screen Shots

Lightbox v3.1 featuring a simple Bug Error userForm Displayed ontop of the White Lightbox

Lightbox v3.1 featuring a simple Bug Error userForm Displayed ontop of the Black Lightbox

Lightbox v1 featuring a light (white) overlay

Lightbox v1 featuring a dark (black) overlay

Lightbox v2 featuring a dark overlay

Lightbox v2 featuring a light overlay

Lightbox v2 Class Code (3 Classes)

Lightbox v3 Dark

Lightbox v3 Full Screen

Lightbox v3 Code (single UserForm Code Module)

Access Lightbox v3 Code (Light)

Access Lightbox v3 Code (Dark)

Video

The Latest Version 3.1 (Single UserForm) Demonstrating a Modal Bug Error UserForm Ontop of the LightBox

Here I run through the Demos that ship with the Lightbox v1 Software and detail the VBA Code

Here I run through the Demos that ship with the Lightbox v2 Software and detail the VBA Code

Here I run through the Demos that ship with the Lightbox v3 Software and detail the VBA Code

Support

Support is 100% optional and I provide it for your convenience, so please be patient, polite and respectful

Support for my Software

  • Responding to questions or problems regarding the Software and its features
  • Fixing valid (replicated) bugs and reported issues for the VERSION I HAVE WRITTEN

Software support does not include

  • Customization and installation services
  • Support for third party software or ANY kind of development whatsoever

Before seeking support

  • Make sure your question is a valid Software Issue and not a customization request
  • Make sure you have read through the FAQ's, online documentation and any related video guides before asking support on how to accomplish a task
  • Ensure that you access to the VBOM is allowed and that Macros can run in Excel
  • Make sure to provide 'proof of purchase' and state the name / version of the Software that you are having issues with when requesting support by Email or via Facebook

How to get Support

Contact Mark Kubiszyn on the Email address provided when you purchased the Software, including the Order Number
Remember to be patient, if there has been an issue with your download, Mark will always respond within 48 hours and will Email you the File directly if neccessary. For other issues the response time may be considerably longer and I may choose to respond to specific questions only (as is my right), depending on what has been asked

Changelog

Read more information on the status of each release below. The latest Version including a description of any changes is shown first

16.12.2021 - (Version 3.2)

Retro-fit fixes for Windows 11 OS, for a Lightbox - applied to all versions. The code detects the the OS Build Number >=22000 indicating Windows 11 or greater and then rounds the Window corners and adjusts the Windows Width & Height

13.10.2021, (Version 3.1)

Quick revisit to this Project in readiness to create a Lightbox for my UserFormExtensibility Software. I needed to refresh my memory of all the different versions of Lightboxes I have created over the years! Here I test some more examples of overlaying Version 3 Lightbox with Modal UserForms to create a Lightbox underneath UserForms



24.12.2020, (Version 3) released. 08.01.2021 added an Access example of usage for Access version 16.0

- Minified single Lightbox UserForm
- Please Note: versions 1 and 2 will be included in the Lightbox.zip File upon purchase



23.12.2020, (Version 2) released

- Minified Classes that allow the dynamic creation of the UserForm and Lightbox
- Easing Functions to control the Fade in and out. Improved Timing Subroutine



19.10.2019, (Version 1) release