Excel 用VBA做的按钮,怎么添加提示信息的
2个回答
展开全部
在工作表中插一个按钮和一个Label标签,将Label标签的背景色设为微黄色,标签的宽度拉长到足够显示提示的内容即可。
设计模式下双击按钮,粘贴以下VBA代码:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
With Sheet1.Label1
If X > 2 And X < (Sheet1.CommandButton1.Width - 2) And Y > 2 And Y < (Sheet1.CommandButton1.Height - 2) Then
.Left = Sheet1.CommandButton1.Left + X
.Top = Sheet1.CommandButton1.Top + Y + Sheet1.CommandButton1.Height
.Caption = "这是按钮1的作用说明"
.Visible = True
Else
.Visible = False
End If
End With
End Sub
设计模式下双击按钮,粘贴以下VBA代码:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
With Sheet1.Label1
If X > 2 And X < (Sheet1.CommandButton1.Width - 2) And Y > 2 And Y < (Sheet1.CommandButton1.Height - 2) Then
.Left = Sheet1.CommandButton1.Left + X
.Top = Sheet1.CommandButton1.Top + Y + Sheet1.CommandButton1.Height
.Caption = "这是按钮1的作用说明"
.Visible = True
Else
.Visible = False
End If
End With
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |