Quick Steps

Notify documentation

2 Simple Steps to start working

  1. Start a Project from scratch using the Notify Workbook that you purchased or Export the 2 UserForm .BAS Files from the Notify Workbook and then Import these Files back into your own Project
  2. Call the Initialise() and DisplayMessage() Subroutines to run Notify - see the examples that come with Notify.xlsm

Acknowledgement

Notify was written by Mark Kubiszyn

  • the latest version is version 1.2
  • as per terms of the Software License, you should leave the following code attribution in situ

' © Copyright/Author:
' Mark Kubiszyn 2012-2017. All Rights Reserved
' Website/Follow:
' http://www.kubiszyn.co.uk/
' https://www.facebook.com/Kubiszyn.co.uk/
						

Purchase

You can Purchase Notify for £2.99 via FastSpring by clicking here

Configuration

Configuring Notify is straightforward. Notify requires one call at the beginning of your Subroutine to initialise the HTML/CSS/Javascript, default settings in memory and another call to display the Message at another point in your Subroutine. The parameters that must be passed include 'Icon', 'Caption', and 'Message'. There is also an optional 'Timeout' value that can be passed to automatically close the Message after a period of time ie. 2 seconds. Here is the Code to Initialise and Display a Success Message that the user can close:

 ' // Success Notification 
 Sub ExampleSuccess()

     ' // initialise
     Notify.Initialise

     ' // do stuff...

     ' // raise a notification
     Notify.DisplayMessage Icon:=Success, Caption:="Success", Message:="Your request has been processed"

 End Sub
						

Here is the Code to Initialise and Display a Success Message that automatically closes after 2 seconds - notice the comma and 2 value added to the end of the call:

 ' // Success Notification
 Sub ExampleSuccess()

     ' // initialise
     Notify.Initialise

     ' // do stuff...

     ' // raise a notification
     Notify.DisplayMessage Icon:=Success, Caption:="Success", Message:="Your request has been processed", 2

 End Sub
						

Notify can display hover Buttons and capture the return result. It can also prevent the user dismissing the Dialog by clicking on the Lightbox. Here is the Code to do both using a Success Dialog:

' // ExamplePreventClickOnLightBoxToDismiss, prevents the user from dismissing the Dialog by the ususal click on the Lightbox
Sub ExamplePreventClickOnLightBoxToDismiss()

    ' // initialise using mapped buttons
    '    you can set the Buttons to a label and caption of your own choice
    '    - they will be styled to the ButtonType for the Dialog ie. success, warning, criticalerror, help
    Notify.Initialise ButtonType:=Success, YesButton:="Yes", YesCaption:="Yes", NoButton:="No", NoCaption:="No"

    ' // raise a notification and capture the result of the button press
    Dim vbResult As VbMsgBoxResult
    vbResult = Notify.DisplayMessage(Icon:=Success, Caption:="Success", Message:="Do you wish to accept the changes?", DismissByLightBoxClick:=False)
    If vbResult = vbYes Then
        MsgBox "You pressed the Yes button", vbInformation
    ElseIf vbResult = vbNo Then
        MsgBox "You pressed the No button", vbInformation
    End If

End Sub
						

You don't have to use the Named Arguments when calling the Initialise() and DisplayMessage() Subroutines and you can also pass HTML into the String Variables for the Button Captions and main Message:

' // an example of not using the Named Arguments to shorten the Code
Sub ExampleBespoke()

    Notify.Initialise Help, "Add Me", "", "Click to Subscribe to my mailing list", "", "64px"

    Dim vbResult As VbMsgBoxResult
    vbResult = Notify.DisplayMessage(Help, "Subscribe", "Subscribe to www.kubiszyn.co.uk")
    If vbResult = vbYes Then
        MsgBox "You pressed the 'Yes please add me to the list' button", vbInformation
    ElseIf vbResult = vbNo Then
        MsgBox "You pressed the No button", vbInformation
    End If

End Sub
						

Function Parameters

Here is a list of Parameters for the Initialise() and DisplayMessage() Subroutines, (marked black) together with examples for each Parameter (where multiple examples are given, you should pass any single occurance as the Parameter):


 Initialise()
   Optional ButtonType As NotificationType, CriticalError, Warning, Success, Help
   Optional ButtonTop As String, "-40px"
   Optional YesButton As String, "Yes", "OK"
   Optional NoButton As String, "No", "Cancel"
   Optional YesCaption As String, "Yes", "Click to Subscribe to the Kubiszyn.co.uk mailing list"
   Optional NoCaption As String, "No", "Click to Cancel the Dialog"
   Optional ButtonWidth As String, "64px"
   Optional ButtonHeight As String, "60px"
   Optional LineHeight As String, "60px"
   Optional DisplayCloseCross As Boolean = True, False

 DisplayMessage()
   ByVal Icon As NotificationType, CriticalError, Warning, Success, Help
   ByVal Caption As String,"Error"
   ByVal Message As String, "Your request has been processed"
   Optional Timeout As Integer = 0, 2
   Optional DismissByLightBoxClick As Boolean = True
						

Developer Tweaks

I have included a few settings that can be tweaked by developers. You can find these at the top of both UserForm Code Modules. You can tweak the Light Box Darkness, the Light Box Timer Speed and the Light Box Transparency Step. For example if you would like a slightly darker LightBox then you would adjust the following setting in the Notify UserForm Code Module from '60' to '80':


 ' // configurable vars for developers 
 ' - use this to deepen the LightBox Colour effect
 '   default 0:=Lightest, 100:=Darkest
 Private Const intLightBoxDarkness As Integer = 80
						

When using the setting above you can also adjust the speed of the LightBox by tweaking the Transparency Step from '8' to '14'. Now the darker LightBox will also fade in at the same rate or slightly faster:


 ' - increase this if using a darker LightBoxOpacity to speed up the LightBox Fade
 '   ie. LightBoxOpacity = 80, intLightBoxTransparencyStep = 14
 Private Const intLightBoxTransparencyStep As Integer = 14
						

If you prefer an even faster, smoother fade speed, you can also tweak the LightBox Timer Speed from '0.02' to '0.01':


 ' // configurable vars for developers
 ' - you can adjust this but ideally only between 0.01 -> 0.03
 '   use the Transparency Step when using a darker LightBox
 Private Const dblLightBoxTimerSpeed As Double = '0.01'
						

Screen Shots

There are 4 types of standard Message Box Dialogs available. Here they are together with their respective standard Icons and Messages - MessageAlignment is 'Left', MessagePadding is standard and the IconPosition is displayed 'BottomRight' (having been designed to fit nicely in this position):

1. Success - Your request has been processed

1. Standard Success Message Box

2. Warning - You must enter all required information

2. Standard Warning Message Box

3. Critical Error - You have encountered a critical error

3. Standard Error Message Box

4. Help - This is a help message for Notify

4. Standard Help Message Box

Here is a non-standard sized Message Box without an Icon, with MessageAlignment 'Justify' using the Success Dialog:

5. Large Success Message Box

Here is the same Message Box with MessagePadding set to '24' and MessageBorderColour '#CCC':

6. Large Padded Border Success Message Box

5. Warning Dialog with Mapped Yes/No Buttons

5. Warning Dialog with Mapped Yes/No Buttons

6. Help Dialog with Bespoke Mapped Button

6. Help Dialog with Bespoke Mapped Button

7. Success Dialog with Mapped Yes/No Buttons

7. Success Dialog with Mapped Yes/No Buttons

8. Critical Error Dialog with Bespoke Yes/No Buttons

8. Error Dialog with Mapped Yes/No Buttons

9. Success Dialog with Bespoke OK Button

9. Success Dialog with Bespoke OK Button

10. Help Dialog with Bespoke Button that will Timeout after 5 seconds

10. Help Dialog with Bespoke Button that will Timeout after 5 seconds

11. Success Dialog with Bespoke HTML formatting for the Message

11. Success Dialog with Bespoke HTML formatting for the Message

Support

Support is only given to Purchased Software. You should only contact me on the Support Email address supplied by FastSpring - please provide proof of purchase ie. Email address or Order Reference

Changelog

17.03.2017 - (Version 1.2) Added mapped hover buttons in colour sets that match the respective 'success', 'warning', 'criticalerror' and 'help' Dialogs. Button Names and Captions can be changed. The Height, Line Height and Width of the Buttons can be adjusted. Notify can now prevent a dismiss when a user clicks on the Lightbox and hide the Close Cross. I have changed the NotificationType 'Error' to 'CriticalError' as I noticed that I was using a reserved word

07.03.2017 - (Version 1.1) Amend to the exit when a user presses on the Lightbox to exit a Notify Message

16.10.2016 - Version 1 released