F
Finny388
My combobox DISAPPEARS when the event handler is triggered!
If I comment out Me.Pictures(1).Delete, it works fine.
If I step through the code - it works fine!!!
I am sure it isn't hidden b/c when I go and create another one, it is
auto-named ComboBox1.
I use that delete line to clear out the existing pic before inserting
another. Why would it delete the combobox too? Is there a better way?
entire code:
Private Sub ComboBox1_Change()
On Error Resume Next
Dim MyPic As IPictureDisp
Me.Pictures(1).Delete
Set MyPic = LoadPicture("I:\Customers\Quadro Catalogue &
Pictures\SAP Pictures\" & Range("D5").Value & ".jpg")
PicPath = "I:\Customers\Quadro Catalogue & Pictures\SAP
Pictures\" & Range("D5").Value & ".jpg"
H = MyPic.Height
W = MyPic.Width
R1 = W / H
Cells(2, 4).Select
Set pic = ActiveSheet.Pictures.Insert(PicPath)
pic.Height = Cells(2, 4).Height
pic.Width = Cells(2, 4).Height * R1
End Sub
If I comment out Me.Pictures(1).Delete, it works fine.
If I step through the code - it works fine!!!
I am sure it isn't hidden b/c when I go and create another one, it is
auto-named ComboBox1.
I use that delete line to clear out the existing pic before inserting
another. Why would it delete the combobox too? Is there a better way?
entire code:
Private Sub ComboBox1_Change()
On Error Resume Next
Dim MyPic As IPictureDisp
Me.Pictures(1).Delete
Set MyPic = LoadPicture("I:\Customers\Quadro Catalogue &
Pictures\SAP Pictures\" & Range("D5").Value & ".jpg")
PicPath = "I:\Customers\Quadro Catalogue & Pictures\SAP
Pictures\" & Range("D5").Value & ".jpg"
H = MyPic.Height
W = MyPic.Width
R1 = W / H
Cells(2, 4).Select
Set pic = ActiveSheet.Pictures.Insert(PicPath)
pic.Height = Cells(2, 4).Height
pic.Width = Cells(2, 4).Height * R1
End Sub