
Originally Posted by
Leith Ross
Hello ABabeNChrist,
Do you want to hide the button, make it invisible, or just keep the button behind the picture?
Hi Lieth Ross
I want the command button to be visible to use, but yet not printable, and once picture is selected the command button goes behind picture, and not visible view. I don’t want command button to be removed, just in case wrong selection was made, that way picture could be deleted and then reuse command button once more to make correct selection. Here is the code I use to inset and size picture.
And yes “just keep it behind picture”
And by the way I’m using Excel 2007
Dim PicLocation As String
Dim MyRange As String
ActiveSheet.Range("B1").Select
MyRange = Selection.Address
PicLocation = Application.GetOpenFilename(FileFilter:="Pic Files (*.jpg;*.bmp), *.jpg;*.bmp", Title:="Browse to select a picture")
If PicLocation <> "False" Then
ActiveSheet.Pictures.Insert(PicLocation).Select
Else
Exit Sub
End If
With Selection.ShapeRange
.LockAspectRatio = msoTrue
If .Width > .Height Then
.Width = Range(MyRange).Width
If .Height > Range(MyRange).Height Then .Height = Range(MyRange).Height
Else
.Height = Range(MyRange).Height
If .Width > Range(MyRange).Width Then .Width = Range(MyRange).Width
End If
End With
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With
Range("A1").Select
Bookmarks