XLA 문서에서 툴바를 어떻게 작성합니까?
-
06-07-2019 - |
문제
XLA 문서를 사용하여 Excel 용 도구 모음을 어떻게 작성합니까?
해결책
Onload 이벤트에서 도구 모음을 만들려면 다음과 같은 작업을 수행 할 것입니다.
Dim myBar As CommandBar, myButt As CommandBarControl
'Delete the toolbar if it already exists'
On Error Resume Next
CommandBars("My Toolbar").Delete
On Error Goto 0
Set myBar = CommandBars.Add(Name:="My Toolbar", _
Position:=msoBarFloating, Temporary:=True)
myBar.Visible = True
' Create a button with text on the bar and set some properties.'
Set myButt = ComBar.Controls.Add(Type:=msoControlButton)
With myButt
.Caption = "Macro1"
.Style = msoButtonCaption
.TooltipText = "Run Macro1"
.OnAction = "Macro1"
End With
' Create a button with an image on the bar and set some properties.'
Set myButt = ComBar.Controls.Add(Type:=msoControlButton)
With myButt
'the faceId line will let you choose an icon'
' If you choose to use the faceId then the caption is not displayed'
.FaceId = 1000
.Caption = "Icon Button"
.TooltipText = "Run Macro2"
.OnAction = "Macro2"
End With
예의 바른 일은 출구에서 도구 모음을 삭제하는 것입니다.
다른 팁
이것이 당신이 찾고있는 것인지 확실하지 않지만 이것이 당신을 도울 수 있다고 생각했습니다.
Excel의 버전을 지정하지 않기 때문에 이것이 당신에게 효과가 있는지 확실하지 않지만 아마도 좋은 출발점을 제공 할 것입니다.
제휴하지 않습니다 StackOverflow