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