Sub speak()
ActiveCell.Select
' MsgBox ActiveCell.Text
' Sheet1.OLEObjects.Add "Forms", , , 100, 100, 100, 100
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Popup "請等待5秒鐘,5秒後該窗口自動關閉", 5, "定時自動關閉提示框"
End Sub
Sub 添加自定義菜單()
On Error Resume Next
Dim myBAR As CommandBarButton
Application.CommandBars("CELL").Controls("朗讀").Delete
Set myBAR = Application.CommandBars("cell").Controls.Add(before:=1) '添加到最上的位置
With myBAR
.Caption = "朗讀"
.BeginGroup = True '添加分組線
.FaceId = 186 '顯示的圖標
.Style = msoButtonIconAndCaption '圖標和文字的顯示
.OnAction = "speak" '指定要運行的宏
End With
End Sub