Option Explicit
Private Sub UserForm_Initialize()
TextBox_InfoBulle = "Ligne1 " & vbCrLf & "Ligne2 " & vbCrLf & "Ligne3 " & vbCrLf & "Ligne4" 'Ajoute le symbole retour à la ligne
Me.TextBox_InfoBulle.SetFocus 'Place le curseur dans la textbox
End Sub
Private Sub BT_OK_Click()
Unload Me
Dim nomshape As Variant
Dim s As Variant
Dim Texte_de_la_bulle As Variant
Texte_de_la_bulle = TextBox_InfoBulle
On Error GoTo Image_non_selectionnee
nomshape = Selection.Name
Set s = ActiveSheet.Shapes(nomshape)
ActiveSheet.Hyperlinks.Add Anchor:=s, Address:="", SubAddress:=""
s.Hyperlink.ScreenTip = Texte_de_la_bulle
Exit Sub
Image_non_selectionnee:
MsgBox "Sélectionne une image avant de lancer la macro.", vbInformation, "Info"
End Sub
Private Sub BT_Annuler_Click()
Unload Me
End Sub
'Pour fermer l'UserForm avec le bouton ESC, le CommandButton1 est caché au bas de l'UserForm
'La propriété Cancel du CommandButton1 doit être à TRUE
Private Sub CommandButton1_Click()
Unload Me
End Sub