Hi All
I am new to forum and a noob with vba / macros i have checked other posts regarding this error but it has not helped. So if i post my code can someone please lead me in the right direction please.
Background
I have a worksheet with forms and on the forms i have a multilevel combo-boxes. When you select Combo1 you then get a selection that you can choose from in Combo2 once you select a item it should fill in the image bozx with the item you selected and this works as you continue to fill out the form all is fine and at the end when you click the submit button it writes the info to another sheet in the workbook which it does but it then gives me the error Runtime Error 53 - File not Found. Very frustrating as i do not understand why.
Code add_frm
Private Sub ComboBox1_Change()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("DropDown")
Dim i As Integer
Me.ComboBox2.Clear
For i = 2 To sh.Range("A" & Application.Rows.Count).End(xlUp).Row
If sh.Range("A" & i).Value = "Cabinet Name" Then
If sh.Range("C" & i).Value = Me.ComboBox1.Value Then
Me.ComboBox2.AddItem sh.Range("B" & i).Value
End If
End If
Next i
End Sub
Private Sub ComboBox2_Change()
Image1.Picture = LoadPicture("C:\Anertex" & "\" & ComboBox2.Value & ".jpg")
'Image1.Picture = LoadPicture(ThisWorkbook.Path & "\" & ComboBox2.Value & ".jpg")' - -- i have aslo tried this
End Sub
All the files exists in the correct path and while in the form it does show you the correct jpg.. Thanks
I am new to forum and a noob with vba / macros i have checked other posts regarding this error but it has not helped. So if i post my code can someone please lead me in the right direction please.
Background
I have a worksheet with forms and on the forms i have a multilevel combo-boxes. When you select Combo1 you then get a selection that you can choose from in Combo2 once you select a item it should fill in the image bozx with the item you selected and this works as you continue to fill out the form all is fine and at the end when you click the submit button it writes the info to another sheet in the workbook which it does but it then gives me the error Runtime Error 53 - File not Found. Very frustrating as i do not understand why.
Code add_frm
Private Sub ComboBox1_Change()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("DropDown")
Dim i As Integer
Me.ComboBox2.Clear
For i = 2 To sh.Range("A" & Application.Rows.Count).End(xlUp).Row
If sh.Range("A" & i).Value = "Cabinet Name" Then
If sh.Range("C" & i).Value = Me.ComboBox1.Value Then
Me.ComboBox2.AddItem sh.Range("B" & i).Value
End If
End If
Next i
End Sub
Private Sub ComboBox2_Change()
Image1.Picture = LoadPicture("C:\Anertex" & "\" & ComboBox2.Value & ".jpg")
'Image1.Picture = LoadPicture(ThisWorkbook.Path & "\" & ComboBox2.Value & ".jpg")' - -- i have aslo tried this
End Sub
All the files exists in the correct path and while in the form it does show you the correct jpg.. Thanks