C
Corey
The below code inserts a picture into the active cell,
But i want ot name the picture a value in the cell above and 1 column to the
right of the cell where the picture is added.
This way i can then use another code to delete it by value.
Can some one assist me ?
Sub Picture_Adder()
Application.ScreenUpdating = False
Call WrkShtPUnP
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Dim res As Variant
'Const sAddress As String = ActiveCell
Set WB = ActiveWorkbook
res = Application.GetOpenFilename _
("Image Files (*.jpg), *.jpg")
If res = False Then Exit Sub
Set SH = ActiveSheet
Set rng = ActiveCell
Set myPic = SH.Pictures.Insert(res)
With myPic
.Top = rng.Top
.Left = rng.Left
myPic.ShapeRange.LockAspectRatio = msoFalse
myPic.ShapeRange.Height = 175#
myPic.ShapeRange.Width = 235.5
myPic.ShapeRange.Rotation = 0#
'myPic.Name = Cells(-1, 1).Value ' <=== Get this to work ??
End With
Call WrkShtPPrt
Application.ScreenUpdating = True
Corey....
But i want ot name the picture a value in the cell above and 1 column to the
right of the cell where the picture is added.
This way i can then use another code to delete it by value.
Can some one assist me ?
Sub Picture_Adder()
Application.ScreenUpdating = False
Call WrkShtPUnP
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim myPic As Picture
Dim res As Variant
'Const sAddress As String = ActiveCell
Set WB = ActiveWorkbook
res = Application.GetOpenFilename _
("Image Files (*.jpg), *.jpg")
If res = False Then Exit Sub
Set SH = ActiveSheet
Set rng = ActiveCell
Set myPic = SH.Pictures.Insert(res)
With myPic
.Top = rng.Top
.Left = rng.Left
myPic.ShapeRange.LockAspectRatio = msoFalse
myPic.ShapeRange.Height = 175#
myPic.ShapeRange.Width = 235.5
myPic.ShapeRange.Rotation = 0#
'myPic.Name = Cells(-1, 1).Value ' <=== Get this to work ??
End With
Call WrkShtPPrt
Application.ScreenUpdating = True
Corey....