Introduction

Introducing Toggle Buttons

Toggle Buttons - use as a switch to toggle an option or setting for Excel

I have been meaning to create some of these little beauties for a while now. I have grouped 2 Shapes, a Toggle Button and a Cylinder to make a nifty Toggle Button that can be copied into a Worksheet. After that, you can then add/link the small VBA Code Subroutine to do the toggling work and to store or update the On/Off values. These Buttons are my own design and Code. I took the Colours for the Demo from an image I found by searching on Google. Then I added a nice little easing function for the smooth animation. The easing function is a Robert Penner easing function called 'easeInQuad'...

Prerequisites

  • Excel 2013 (Version 5) & Excel 2016 (32bit or 64bit, Version 8)
  • Basic to moderate Excel Skills and some VBA skills to copy a Grouped Shape and then link a Subroutine
  • Windows PC · NOT a Mac!
  • No support is provided for customization of this Software

Features

  • Copy the Grouped Shape to make more Toggle Buttons
  • Store the Toggled values








Installation

ToggleButtons.xlsm is ready to use (version specific naming of the file will differ with each new release). Open theToggleButtons.xlsm File and test out the Demo Buttons. The Demo Sheet doesn't really need that much of an explanation. There are two Toggle Buttons that capture their respective 'toggled' values

Usage

ToggleButtons.xlsm


Using the Toggle Buttons in your own Project
To use the Toggle Buttons in your own Project, first Unprotect the Interface by just doing Unprotect Sheet on the Protect Group of the Review Tab on the Ribbon. Right-click a Shape and use the Selection Pane on the Editing Group of the Home Tab of the Ribbon to make Selections easier. Now, Copy the Shape (it's Grouped) and Paste onto any Worksheet. If you need more than one set of Toggle Buttons then repeatedly Paste more until you have the amount that you need. Now rename the Toggle Button Shapes and individual Shapes using the suffix 2, 3, 4 etc. The Code uses the Application.Caller() method to retrive the Toggle Button Name and with this, it can then find the Cylinder and the Group Name - it is still wise to make all of the Shapes have unique Names as this is good practice, but the Code means that no Names need to be hard-coded. Remember to use the Selection Pane to do this as it's easier and you can see what you are changing. Now Copy the Code in the Sheet1 Code Module into your own Project Worksheet Code Module. That's it, click one of the Toggle Buttons to protect the Interface. The Code below details haow the Toggle Button and Cylinder are known via Application.Caller():
    
   ' assign Shapes, we use 1 x Cylinder and 1 x ToggleButton and Group them together as Toggle so the we do not have to hard-code any Names
   Set Toggle = Me.Shapes(CStr(Application.Caller)).ParentGroup
   Set ToggleButton = Me.Shapes(CStr(Application.Caller))
   Set Cylinder = Me.Shapes(Toggle.Name).GroupItems(1)



The Toggle or Click Macro
You need to add the Sheet1.Toggle Macro to the ToggleButton Shape only, not the Cylinder or the Group, Toggle Shape. You should use the Find & Select, Selection Pane to highlight the ToggleButton and then right-click on it and assign the Macro. Always use the same Macro for different Toggle Buttons. Please Note: when starting a new Project and Copying over the Buttons, Save the Project when you have finished and added the Macros to the Toggle Buttons and then Close the File! Reopen it and test the Toggle Buttons

Changing the Colours of the Toggle Button and the Cylinder Shapes
Changing the Colour of the Shapes is easy. Go into the Code and in the Toggle Subroutine, scroll down to the bottom of the Code. To change the Colour of the Cylinder, change the RGB values of the Cylinder and to change the Colours of the Toggle Button, change the Fill and Line (Border) RGB values of the Toggle Button. Do this for both RGB values for each Shape Object as per below (you can also use long Colours):
    
   ' style according to the current direction applied to the Toggle (this is the switched On direction)
   If Direction Then
      Cylinder.Fill.ForeColor.RGB = RGB(77, 182, 172)      ' the Cylinder

      ToggleButton.Fill.ForeColor.RGB = RGB(128, 203, 196) ' the circle of the Toggle Button
      ToggleButton.Line.ForeColor.RGB = RGB(224, 242, 241) ' the outer circle or border of the Toggle Button 



Changing the Alt. Text of the ToggleButton
I have done the hard work for you already, however if you have an error when creating a new Toggle Button if you use your own Shapes then remember to edit the Alt. Text as per the image below (set to True or False for the Code to work correctly when using my Subroutine and easing function):



Toggle Buttons

The Demo Toggle Buttons, one is switched On and the other is switched Off

Dark Mode Toggle Buttons are more compact

The Toggle Button background Colours are easy to Change - here is a Screen Shot I did by changing the Toggle Button Fill and Line (or Border) Colour and the Cylinder Fill Colour

FAQ

There are no Q & A for the Toggle Buttons


Toggle Buttons

This is a video of the Toggle Buttons Demo

This is a video of the Toggle Buttons Dark Mode Demo which uses compact, purple Toggle Buttons

Support

Please remember you have purchased very affordable Software and you have not paid for a full-time Software design agency - I am but one man. Occasionally I may help with small tweaks, but these requests will be put on a much lower priority due to their nature. You have not PAID for Support, Support is 100% optional and I provide it for your convenience, so please be patient, polite and respectful

Support (limited) for my Software includes

  • 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
...or Contact Mark Kubiszyn via our Facebook Page - 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 or via Messenger. 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

Future Builds

* No ideas as yet!

Bug Fixes

* There are currently no bugs identified

Changelog

You can find the version history in the Code Module for any Macro-enabled Software or read more information on the status of each release
- the latest Version including a description of any changes made is always shown first

06.12.2020 - (Version 1.1)

Added a Dark Mode with some compact Toggle Buttons

04.12.2020 - (Version 1) Released

General release of the first version of Toggle Buttons