C
Corey
Sub Button36_Click()
On Error Resume Next
Range("C97").Select
Application.ScreenUpdating = False
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 = 215.1
myPic.ShapeRange.Width = 250#
myPic.ShapeRange.Rotation = 0#
'myPic.Name = ActiveCell.Offset(-1, 1).Value
End With
Application.ScreenUpdating = True
Range("L101").Select
End Sub
The above code when run prompts for a image selection and pastes it to size on a sheet.
However, i am now getting an error.
McAffee Buffer overflow Blocked. Then saying something about address.
I think it may be because the default folder it looks to is on a network.
Is there a way for me to add a line of code to look to a local folder instead?
Corey...
On Error Resume Next
Range("C97").Select
Application.ScreenUpdating = False
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 = 215.1
myPic.ShapeRange.Width = 250#
myPic.ShapeRange.Rotation = 0#
'myPic.Name = ActiveCell.Offset(-1, 1).Value
End With
Application.ScreenUpdating = True
Range("L101").Select
End Sub
The above code when run prompts for a image selection and pastes it to size on a sheet.
However, i am now getting an error.
McAffee Buffer overflow Blocked. Then saying something about address.
I think it may be because the default folder it looks to is on a network.
Is there a way for me to add a line of code to look to a local folder instead?
Corey...