Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim cbcControl As CommandBarControl
'***************************************************
'* If the button does NOT exist, then create it. *
'***************************************************
On Error Resume Next
Set cbcControl = CommandBars("NameOfTheCommandBar").Controls("NameOfYourControl")
'**********************************************
'* If the button doesn't exist, then add it *
'**********************************************
If (Err.Number = 5) Then 'IFT, button doesn't exist
On Error GoTo ErrHandler
Set cbcControl = CommandBars("NameOfTheCommandBar").Controls.Add(msoControlButton)
With cbcControl
.Caption = "Whatever"
.Tag = "Whatever"
.OnAction = "NameOfFunctionToCall"
.Visible = True
.BeginGroup = True
.DescriptionText = "Whatever"
End With
End If