Notes and Excel

Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim collection As NotesDocumentCollection
    Dim doc As NotesDocument  
    Set db = session.CurrentDatabase
    Set collection = db.UnprocessedDocuments
    
    Set AppEXCEL = CreateObject("Excel.Application")
    Set WorkBook = AppEXCEL.Workbooks.Add
    Set Sheet = WorkBook.Worksheets(1)
    Sheet.Columns("A:AN").Font.Name = "Arial"
    Sheet.Columns("A:AN").Font.Size = "12"
    
    For j = 1 To collection.count
        Set doc = collection.GetNthDocument(j)
        
        Dim row0() As String   
        Dim row1() As String
        Dim row2() As String
        For i = 0 To Ubound(doc.Date_Status)
            x_Status = word(doc.Date_Status(i),"^",1)
            x_Date = word(doc.Date_Status(i),"^",2)
            Redim Preserve row0(i) As String
            row0(i) =  x_Status
            Redim Preserve row1(i) As String
            row1(i) =  x_Date
            Redim Preserve row2(i) As String
            row2(i) =  doc.AppNo(0)
            Redim Preserve row3(i) As String
            row3(i) =  doc.Date_Created(0)
        Next    
        
        With Sheet  
            Dim cRol As Integer
            Dim cCol As Integer
            cRol = j+1  '行
            
            cCol = 1
            .Cells(cRol,cCol).Value="表单编号"
            
            cCol = 2  '列
            For i=0 To Ubound(row2)
                .Cells(cRol,cCol).Value=row2(i)
            Next
            
            cCol = 3    
            .Cells(cRol,cCol).Value="创建时间"
            
            cCol = 4
            For i=0 To Ubound(row1)
                .Cells(cRol,cCol).Value=row3(i)
            Next
            
            cCol = 5  '列
            For i=0 To Ubound(row0)
                .Cells(cRol,cCol).Value=row0(i)
                cCol = cCol + 2
            Next
            
            'cRol = j+1
            cCol = 6
            For i=0 To Ubound(row1)
                .Cells(cRol,cCol).Value=row1(i)
                cCol = cCol + 2
            Next
        End With
        
        Sheet.Columns("A:AN").EntireColumn.AutoFit
    Next
    
    AppEXCEL.DisplayAlerts = False
    AppEXCEL.visible = True
    
    Set AppExcel = Nothing
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值