Hi,
I use the following code which works as wanted:
The only thing is that I would like the code to insert the image without link to the image file. That is; the Excel workbook should be possible to send to different users, and the image file path could be changed..
I have found something like
But it doesn't work when I replace the existing code with this..
I use the following code which works as wanted:
Code:
Private Sub CommandButton1_Click()
Dim myPicture
Dim MyObj As Object
Application.ScreenUpdating = False
Sheets("Kumkort").Unprotect
myPicture = Application.GetOpenFilename _
("Bilder (*.gif; *.jpg; *.jpeg; *.png; *.bmp; *.tif),*.gif; *.jpg; *.jpeg; *.png; *.bmp; *.tif", _
, "Velg bilde som skal settes inn")
If VarType(myPicture) = vbBoolean Then Exit Sub
On Error Resume Next
Sheets("Kumkort").Shapes("Kumkort_bilde1").Delete
On Error GoTo 0
On Error Resume Next
Sheets("Kumkort").Shapes("Kumkort_bilde2").Delete
On Error GoTo 0
On Error Resume Next
Sheets("Kumkort").Shapes("Kumkort_bilde3").Delete
On Error GoTo 0
On Error Resume Next
Sheets("Kumkort").Shapes("Kumkort_bilde4").Delete
On Error GoTo 0
Range("B23").Select
Set MyObj = Sheets("Kumkort").Pictures.Insert(myPicture)
With MyObj
With .ShapeRange
.LockAspectRatio = msoTrue
.Height = 328
'.Width = 434
.Top = Range("B23").Top
.Left = Range("B23").Left
.Name = "Kumkort_bilde1"
End With
.Placement = xlMoveAndSize
End With
Set MyObj = Nothing
ActiveSheet.Shapes.Range(Array("Kumkort_bilde1")).Select
Selection.ShapeRange.IncrementTop 5
Selection.ShapeRange.IncrementLeft 5
Sheets("Kumkort").Protect
Application.ScreenUpdating = True
Kumkort_BildeForm.Hide
End Sub
The only thing is that I would like the code to insert the image without link to the image file. That is; the Excel workbook should be possible to send to different users, and the image file path could be changed..
I have found something like
Code:
ActiveSheet.Shapes.AddPicture
But it doesn't work when I replace the existing code with this..