2
下面的代碼中缺少什麼,.Caption
得到了什麼,並且頂部的圖標?如何使用VBA製作帶有圖標下方標題的工具欄按鈕?
Sub SoundLogToolbar()
Dim cb As CommandBar
Dim de As CommandBar
Dim but As CommandBarButton
Dim picPicture As IPictureDisp
On Error Resume Next
MkDir "C:\SoundLog\"
On Error GoTo 0
On Error Resume Next
MkDir "C:\SoundLog\Presentations\"
On Error GoTo 0
Set picPicture = stdole.StdFunctions.LoadPicture("C:\SoundLog\Presentations\SoundLog.gif")
On Error Resume Next
Application.CommandBars("SoundLog").Delete
On Error GoTo 0
Set cb = Application.CommandBars.Add("SoundLog", msoBarTop, , True)
Set but = CommandBars("SoundLog").Controls.Add(msoControlButton)
but.Visible = True
With but
.Picture = picPicture
.OnAction = "ShowUserForm"
.Caption = "SoundLog!"
.TooltipText = "run this to get data!"
.Style = msoButtonIconAndCaptionBelow
End With
cb.Visible = True
End Sub
隨着msoButtonIconAndCaptionBelow
按鈕樣式,它不是想要像我想要的?
我看不到如何在創建包含圖片的目錄但不將gif複製到目錄時找到圖片。 – Fionnuala 2010-02-25 23:39:05
哦,這是從另一個子副本/過去。不要嘲笑它。使用此代碼,會創建按鈕和工具欄,但按鈕的左側有小圖標和標題。我想創建一個按鈕,比如Powerpoint2007的「新幻燈片」(帶有下面標題的大圖標)---> msoButtonIconAndCaptionBelow – 2010-02-26 12:17:57