Hi, I'm trying to activate an image in my image box when I select a product from my Combo box1 but here's where my limitations kick in. I've got some basic code but I imagine its full of errors. The basic functioning asks the ComboBox1 to access a directory of pictures and load them into ImageBox called Image1. Any assistance would be greatly appreciated.
Here's the code:
Private Sub pict()
Image1.Picture = LoadPicture("\SVR2\Data\Common Folders\Technical & QA\CAD\IMAGES FOR LABELS\QR Codes" & ComboBox1)
End Sub
Sub Pictotal()
Dim picname As String
Image1.Select 'This is where picture will be inserted
picname = ComboBox1 'This is the picture name
On Error Resume Next
'delete previous pic
ActiveSheet.Pictures("Picture").Delete
Err.Clear
Err.Number = 0
On Error GoTo 0
On Error Resume Next
MsgBox "image test"
If (Dir("\SVR2\Data\Common Folders\Technical & QA\CAD\Images for labels\QR Codes" & picname & ".png") = vbNullString) Then Exit Sub
ActiveSheet.Pictures.Insert("\SVR2\Data\Common Folders\Technical & QA\CAD\Images for labels\QR Codes" & picname & ".png").Select
'Path to where pictures are stored
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' This resizes the picture
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
With Selection
.Name = "Profile"
.Left = Range.Image1.Left * 7.5
.Top = Range.Image1.Top * 1.27
.ShapeRange.LockAspectRatio = msoTrue
.ShapeRange.Height = 130#
.ShapeRange.Width = 130#
.ShapeRange.Rotation = 0#
End With
End Sub
Bookmarks