Hello respected Gurus!
I have a simple userform.that is placing the data on sheet1 .I am have a image control on my userform. I have the pictures in the same location where my workbook exists.I have named those pictures what I have in Column A through TextBox1.The code was working fine before I added the lines of code to load pictures.But with no luck I am getting "Run-time error '24' Object required.Clicking Debug the bold line of code is highlighted.The out put I want from this code is to load picture for the specific record and it should navigate with the next and previous button. In order to understand the situation more easily, I have attached a dummy project here
Private Sub cmdNext_Click()
CurrentRow = CurrentRow + 1
Update_Form
Dim NameFound As Range
fPath = ThisWorkbook.Path & " \ "
With Cells(CurrentRow, 1).Value
Set NameFound = .Find(TextBox1.Text)
With NameFound
On Error Resume Next
ImgData.Picture = LoadPicture(fPath & “nopic.jpg”)
ImgData.Picture = LoadPicture(fPath & TextBox1.Text & ".jpg")
End With
End With
TextBox1.Value = Cells(CurrentRow, 1).Value
TextBox2.Value = Cells(CurrentRow, 2).Value
TextBox3.Value = Cells(CurrentRow, 3).Value
End Sub
Best Regards
Imran Bhatti
Bookmarks