Load image into image box advice

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,726
Office Version
  1. 2007
Platform
  1. Windows
Afternoon,

Ive got a userform which is working well but struggling to load an image when text boxes are filled with data from combobox selection.
Ive used a code taken from another page but need help please on correctly adding the path to where the images are stored.
This is the path for where the images are.
DESKTOP,REMOTES,LOCK PICKING IMAGES

Now when i make a selection from the combobox not only does the text boxes get entered with the correct data but also an image.

I have supplied the code in use below.

Code:
Private Sub ComboBox1_DropButt*******()Dim i As Long, LastRow As Long
LastRow = Sheets("INFO").Range("BC" & Rows.Count).End(xlUp).Row
If Me.ComboBox1.ListCount = 0 Then
For i = 2 To LastRow
Me.ComboBox1.AddItem Sheets("INFO").Cells(i, "BC").Value
Next i
End If
End Sub
Private Sub ComboBox1_Change()
Dim i As Long, LastRow As Long
LastRow = Sheets("INFO").Range("BC" & Rows.Count).End(xlUp).Row
For i = 2 To LastRow
If Sheets("INFO").Cells(i, "BC").Value = (Me.ComboBox1) Or _
Sheets("INFO").Cells(i, "BC").Value = Val(Me.ComboBox1) Then
Me.TextBox1 = Sheets("INFO").Cells(i, "BE").Value
Me.TextBox2 = Sheets("INFO").Cells(i, "BG").Value
Me.TextBox3 = Sheets("INFO").Cells(i, "BI").Value
Me.TextBox4 = Sheets("INFO").Cells(i, "BK").Value
Me.TextBox5 = Sheets("INFO").Cells(i, "BM").Value
Me.TextBox6 = Sheets("INFO").Cells(i, "BO").Value
Me.TextBox7 = Sheets("INFO").Cells(i, "BS").Value
Me.TextBox8 = Sheets("INFO").Cells(i, "BQ").Value
Me.TextBox9 = Sheets("INFO").Cells(i, "BU").Value
End If
Next
End Sub
Private Sub KeyType_Change()
If (Me.TextBox1.Value) = "" Then
   Me.Image1.Picture = LoadPicture(ThisWorkbook.Path & "\dr-logo.jpg")
Else
  Image1.Picture = LoadPicture(ThisWorkbook.Path & "\" & HondaPartNumber.Value & ".jpg")
End If
End Sub

Many thanks
 
His post is based on what you indicated in post #5.
It’s location is as follows.
C
Desktop
Remotes
Lock picking images.
Space in between lock picking images
I doubt Desktop is at the root directory level, but if you're not interested in checking, so be it.
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
I’m not at home where the pc is so has nothing to do with not checking it.

I was advising that the _ isnt required.
Some of your replies I don’t like.
 
Upvote 0

Forum statistics

Threads
1,223,710
Messages
6,174,019
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top