Tema: error 1004
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/11/2009, 09:26
Eiabel
 
Fecha de Ingreso: noviembre-2009
Mensajes: 14
Antigüedad: 14 años, 6 meses
Puntos: 0
Pregunta error 1004

hola expertos,

una consulta me ha salido un error '1004' Application-defined or object-defined error, en esta linea del codigo :Hoja.Cells(indice, 23).AddComment Text:=frmPrincipal.presentacion.Text

Cabe decir que estuvo funcionando sin ningun problema, quice agregar otro txtbox y comenzo a aprecer este error, ya lo quite y me sigue apareciendo el error. espero puedan ayudarme

CODIGO

Private Sub Ingresar_Click()
Dim openExcel As New excel.Application
Dim Libro As excel.Workbook, Hoja As excel.Worksheet

MsgBox "Datos Ingresados"

openExcel.Visible = False
Dim indice As Integer
Set Libro = openExcel.Workbooks.Open("\\Gabi\d\Base de Datos\base de datos.xls")
Set Hoja = Libro.Worksheets(1)
'Aca guardamos la ultima columna ocupada

For indice = 2 To 500

If Hoja.Cells(indice, 23).FormulaR1C1 = "" Then

If Option1.Value = True Then Hoja.Cells(indice, 23).FormulaR1C1 = Option1.Caption
If Option2.Value = True Then Hoja.Cells(indice, 23).FormulaR1C1 = Option2.Caption
If Option3.Value = True Then Hoja.Cells(indice, 23).FormulaR1C1 = Option3.Caption

Hoja.Cells(indice, 23).AddComment Text:=frmPrincipal.presentacion.Text <--------ERROR

If Option4.Value = True Then Hoja.Cells(indice, 24).FormulaR1C1 = Option4.Caption
If Option5.Value = True Then Hoja.Cells(indice, 24).FormulaR1C1 = Option5.Caption
If Option6.Value = True Then Hoja.Cells(indice, 24).FormulaR1C1 = Option6.Caption

Hoja.Cells(indice, 24).AddComment Text:=frmPrincipal.Text2.Text


Exit For
End If


Next indice

'Esto es para que no te de el mensaje que el archivo ya existe
openExcel.DisplayAlerts = False
Libro.Save
'Activamos los alertas nuevamente
openExcel.DisplayAlerts = True
Libro.Close
End Sub



Saludos y muchas gracias!!