RE:Exportar datos de Lotus a Excell
Dim Ns As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim Doc As NotesDocument
Dim Excel As Variant
Dim XLWorkBook As Variant
Dim XHoja As Variant
Set db = Ns.CurrentDatabase
Set Nws=New notesuiworkspace
Set Nuid=Nws.CurrentDocument
Set Nd=Nuid.Document
Set View=db.GetView("Nombre_vista") 'vista de la cual se exportara la información
Set Doc = View.GetFirstDocument 'Posiciona en el primer registro
Print "Iniciando la creacion del informe..."
Print "Conectando con EXCEL ..."
Set Excel = CreateObject("Excel.Application")
Excel.Visible = True ' Se Muestra la Ventana de Excel
Excel.Workbooks.Add ' Se Crea un Libro de Excel Nuevo
Set XLWorkbook = Excel.ActiveWorkbook ' Se Seleccion el libro Activo nRenglon=0
nDocumento=0
Print "Creando Informe . . ."
nRenglon=nRenglon+1
nDocumento=nDocumento+1
fecha= Evaluate("@Now") 'Variable para la fecha de hoy
Excel.Cells(nRenglon,1).Value = Fecha
Excel.Cells(nRenglon,1).Select
nRenglon=nRenglon+1
Excel.Selection.Font.Bold= True
Excel.Cells(nRenglon,1).Value = "Titulo"
Excel.Cells(nRenglon,1).Select
Excel.Selection.Font.Bold= True
Excel.Selection.Font.Italic=True
Excel.Selection.Interior.ColorIndex=14
Excel.Selection.Font.Size=10
Excel.Range("A2:E2").Select
Excel.Selection.Merge
nRenglon=nRenglon+1 'Siguiente Renglon
Excel.Cells(nRenglon,1).Value = "Encabezado1"
Excel.Cells(nRenglon,1).Select
Excel.Selection.Font.Bold= True
Excel.Selection.Font.Size= 10
Excel.Cells(nRenglon,2).Value = "Encabezado2"
Excel.Cells(nRenglon,2).Select
Excel.Selection.Font.Bold= True
Excel.Selection.Font.Size= 10
Excel.Cells(nRenglon,3).Value = "Encabezado3"
Excel.Cells(nRenglon,3).Select
Excel.Selection.Font.Bold= True
Excel.Selection.Font.Size= 10
Excel.Cells(nRenglon,4).Value = "Encabezado4"
Excel.Cells(nRenglon,4).Select
Excel.Selection.Font.Bold= True
Excel.Selection.Font.Size= 10
Excel.Cells(nRenglon,5).Value = "Encabezado5"
Excel.Cells(nRenglon,5).Select
Excel.Selection.Font.Bold= True
Excel.Selection.Font.Size= 10
nRenglon=nRenglon+1 'Siguiente Renglon
While Not (Doc Is Nothing)
Excel.Cells(nRenglon,1).Value = Doc.campo1(0)
Excel.Cells(nRenglon,2).Value = Doc.campo2(0)
Excel.Cells(nRenglon,3).Value = Doc.campo3(0)
Excel.Cells(nRenglon,4).Value = Doc.campo4(0)
Excel.Cells(nRenglon,5).Value = Doc.campo5(0)
nRenglon=nRenglon+1 'Siguiente Renglon
Set Doc = View.GetNextDocument(Doc)
Wend
Excel.Columns("A:A").EntireColumn.Autofit
Excel.Columns("B:B").EntireColumn.Autofit
Excel.Columns("C:C").EntireColumn.Autofit
Excel.Columns("D:D").EntireColumn.Autofit
Excel.Columns("E:E").EntireColumn.Autofit