Mouse over command button VBA code

Nyanko

Active Member
Joined
Sep 1, 2005
Messages
437
Hi,

I've found and adapted the following code for utilizing the cell comment feature as a mouse hover description on a command button :

Code:
Private Sub CommandButton3_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
     Application.EnableEvents = False
     On Error Resume Next
     'assuming your comment is in AC3
     Range("AC3").Comment.Visible = True
     Pause 1
     Range("AC3").Comment.Visible = False
     Application.EnableEvents = True
End Sub

Public Function Pause(DelayInSeconds)
     Dim StartTime As Double
     StartTime = Timer
     Do While Timer < StartTime + DelayInSeconds
           DoEvents
     Loop
End Function

Private Sub CommandButton3_Click()
    On Error GoTo 1
    ActiveWorkbook.FollowHyperlink "http://about.me/AboutCatherine", NewWindow:=True
    Exit Sub
1:           MsgBox Err.Description
End Sub

Problem is that the mouse over potion of the code seems to override the hyperlink code so that the cell comment hover option works but when you click the button nothing happens.

Any help or assistance would be appriciated.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
It works fine here. Are you sure CommandButton3_Click is really not being invoked?

Place a breakpoint on the line On Error GoTo 1 then click the button and check that.
 
Upvote 0

Forum statistics

Threads
1,224,719
Messages
6,180,535
Members
452,986
Latest member
Banahaw2509

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top