L
Les Stout
Hi all, is it possible to know, with code, which button has been
activated with vba as i would like to use an if statement. I create the
bar with the code below.
Sub addToolbarQ()
'
Application.DisplayAlerts = False
Dim oCBMenuBar As CommandBar
Dim oCBCLeave As CommandBarControl
Dim iMenu As Integer
Dim i As Integer
On Error Resume Next
Application.CommandBars("ZA-TM-RECON").Delete
Application.IgnoreRemoteRequests = True
Set oCBMenuBar = Application.CommandBars.Add(Name:="ZA-TM-RECON")
With oCBMenuBar
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = True
.FaceId = 3
.TooltipText = "Save file"
.OnAction = "restoreToolbarsQ"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 4
.TooltipText = "Print Document"
.OnAction = "GetPeriodQ1"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 271
.TooltipText = "Save Recon to process later"
.OnAction = "SaveToQuery1"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 363
.TooltipText = "Send this document to the supplier"
.OnAction = "InsertColumnsQ"
End With
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = True
.FaceId = 108
.TooltipText = "Adopt all changes"
.OnAction = "AdoptAllPriceDiff"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 387
.TooltipText = "Adopt changes individually"
.OnAction = "AdoptPriceDiffSep"
End With
' With .Controls.Add(Type:=msoControlButton)
' .FaceId = 157
' .TooltipText = "Last month"
' .OnAction = "lastMonth"
' End With
' With .Controls.Add(Type:=msoControlButton)
' .BeginGroup = True
' .Caption = "Summary"
' .Style = msoButtonCaption
' .TooltipText = "Show summary sheet"
' .OnAction = "gotoSummary"
' End With
.Position = msoBarTop
.Protection = msoBarNoMove
.Visible = True
End With
End Sub
Les Stout
*** Sent via Developersdex http://www.developersdex.com ***
activated with vba as i would like to use an if statement. I create the
bar with the code below.
Sub addToolbarQ()
'
Application.DisplayAlerts = False
Dim oCBMenuBar As CommandBar
Dim oCBCLeave As CommandBarControl
Dim iMenu As Integer
Dim i As Integer
On Error Resume Next
Application.CommandBars("ZA-TM-RECON").Delete
Application.IgnoreRemoteRequests = True
Set oCBMenuBar = Application.CommandBars.Add(Name:="ZA-TM-RECON")
With oCBMenuBar
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = True
.FaceId = 3
.TooltipText = "Save file"
.OnAction = "restoreToolbarsQ"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 4
.TooltipText = "Print Document"
.OnAction = "GetPeriodQ1"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 271
.TooltipText = "Save Recon to process later"
.OnAction = "SaveToQuery1"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 363
.TooltipText = "Send this document to the supplier"
.OnAction = "InsertColumnsQ"
End With
With .Controls.Add(Type:=msoControlButton)
.BeginGroup = True
.FaceId = 108
.TooltipText = "Adopt all changes"
.OnAction = "AdoptAllPriceDiff"
End With
With .Controls.Add(Type:=msoControlButton)
.FaceId = 387
.TooltipText = "Adopt changes individually"
.OnAction = "AdoptPriceDiffSep"
End With
' With .Controls.Add(Type:=msoControlButton)
' .FaceId = 157
' .TooltipText = "Last month"
' .OnAction = "lastMonth"
' End With
' With .Controls.Add(Type:=msoControlButton)
' .BeginGroup = True
' .Caption = "Summary"
' .Style = msoButtonCaption
' .TooltipText = "Show summary sheet"
' .OnAction = "gotoSummary"
' End With
.Position = msoBarTop
.Protection = msoBarNoMove
.Visible = True
End With
End Sub
Les Stout
*** Sent via Developersdex http://www.developersdex.com ***