
01/08/2008, 06:48
|
| | Fecha de Ingreso: julio-2008
Mensajes: 36
Antigüedad: 16 años, 9 meses Puntos: 0 | |
Respuesta: Excel y Visual Basic 6.0 Ya he conseguido que funcione, pero he tenido que cambiar el código que tú me diste por este otro:
Private objExcel As Object
Private xLibro As Object
Private Sub Timer1_Timer()
Label1.Caption = cells(1, 2)
End Sub
Private Sub Command1_Click()
Dim Col As Integer, Fila As Integer
Set objExcel = New Excel.Application
Set xLibro = objExcel.Workbooks.Open("C:\hoja.xls")
objExcel.Visible = True
With xLibro
With .Sheets(1)
Fila = 1
Label1.Caption = cells(Fila, 2)
Fila = 2
cells(Fila, 2) = Text1.Text
End With
End With
End Sub
He cambiado "Label1.Caption = xLibro.Worksheets("Hoja1").Range("A1")" por: "Label1.Caption = cells(1, 2)", de esta manera sí me funciona.
Gracias. |