Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/12/2005, 09:08
jorevale
Invitado
 
Mensajes: n/a
Puntos:
Pregunta Error en el método 'Add' del objeto 'Workbooks'

Hola amigos

En éste código, extraído de:

http://www.vb-mundo.com/verTruco.asp?truco=244

me manda el error del título... alguno de uds. podría orientarme sobre lo que pasa?

'Añade un command Button a tu formulario
'Añade la referencia Microsoft Excel X.0

Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim xlWS As Excel.Worksheet
Set xlApp = New Excel.Application
Set xlWB = xlApp.Workbooks.Add
Set xlWS = xlWB.Worksheets.Add
xlWS.Cells(2, 2).Value = 1
xlWS.Cells(1, 3).Value = 2
' Nos guardara esto en el fichero excel llamdo prueba.xls
xlWS.SaveAs "c:\prueba.xls"
xlApp.Quit
Set xlWS = Nothing
Set xlWB = Nothing
Set xlApp = Nothing
End Sub