This is a two part request. Before you spend time analyzing the code, please read #2.
(1.) I have tried to create a command button to display a picture with the following code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim LineName As String, T As String
myDir = "C: \users\me\pictures\stuff"
LineName = Range("A2")
T = ".jpg"
ActiveSheet.Shapes.AddPicture Filename:=myDir & LineName & T, linktofile:=msoFalse, savewithdocument:=msoFalse, Left:=190, Top:=10, Width:=434, Height:=205
Application.ScreenUpdating = True
End Sub
When I click it gives me Run-time error '1004': The specified value is out of range, and the ActiveSheet.Shapes.AddPicture Filename:=myDir & LineName & T, linktofile:=msoFalse, savewithdocument:=msoFalse, Left:=190, Top:=10, Width:=434, Height:=205 line is highlighted yellow.
(2.) When the issue with this code is solved, then how do I get the picture to go away? My preferred method is to forget the above code and create a button to have a picture displayed when the user hovers the pointer over it and then go away after the pointer is moved away. However, I am OK with whatever works.
Bookmarks