View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_2_] GS[_2_] is offline
external usenet poster
 
Posts: 3,514
Default Runtime error 91: Object variable or With block variable not set

Try...

Private Sub ComboBox1_Change()

Dim fso As Object, rngFound As Range
Dim ruta$, imagen$, ruta_e_imagen$ 'type=String

Set fso = CreateObject("Scripting.FileSystemObject")
ruta = ActiveWorkbook.Path
imagen = ComboBox1.List(ComboBox1.ListIndex) & ".jpg"
ruta_e_imagen = ruta & "\FOTOS\" & imagen

If fso.FileExists(ruta_e_imagen) Then
Image1.Picture = LoadPicture(ruta_e_imagen)
Set rngFound = Cells.Find(What:=Replace(imagen, ".jpg", ""))
If rngFound Is Nothing Then GoTo NotFound

With rngFound
Label3 = .Offset(0, 1): Label2 = .Offset(0, 2)
Label12 = .Offset(0, 10): Label13 = .Offset(0, 11)
Label14 = .Offset(0, 12): Label15 = .Offset(0, 13)
Label16 = .Offset(0, 14)
End With 'rngFound
Else
GoTo NotFound
End If

NormalExit:
Exit Sub

NotFound:
MsgBox "La Imagen: " & imagen & ", NO está disponible"
End Sub

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com