Hello, I have the following code that I got with the help of this wonderful forum. I have modified a little but it is not working. Would it be possible to get your help?
When I run the above code, it gives me error in this line: SavePicture picControl.Picture, path. I would like the picture loaded in userfomer1 Image1 saved with that name and Image 2 saved with that name as well in the path that depends on CAR #. Can you help me please?
Code:
Private Sub PicToSheet1(picControl, sht As Worksheet)
Dim PCAR As String
CAR = Me.TextBox1.Value
Dim p As String, L As Double, T As Double, H As Double
path = "C:\Users\Anahi\Desktop\PCAR Project\Folders" & CAR
'save temporary image to folder
SavePicture picControl.Picture, path
'embed image in sheet
L = sht.Cells(13, 1).Left: T = sht.Cells(13, 1).Top
With sht.Shapes.AddPicture(Filename:=p, linktofile:=msoFalse, savewithdocument:=msoCTrue, Left:=L, Top:=T, Width:=290, Height:=220)
.Placement = xlMove
.OLEFormat.Object.PrintObject = msoTrue
.OLEFormat.Object.Locked = msoTrue
End With
'delete temporary file
End Sub
When I run the above code, it gives me error in this line: SavePicture picControl.Picture, path. I would like the picture loaded in userfomer1 Image1 saved with that name and Image 2 saved with that name as well in the path that depends on CAR #. Can you help me please?
Last edited by a moderator: