Dim StartDate As Date
Dim EndDate As Date
With RibbonTabs("控制版面")("功能")
StartDate = .Items("StartDate").Value
End With
With RibbonTabs("控制版面")("功能")
EndDate = .Items("EndDate").Value
End With
If StartDate = Nothing
MessageBox.Show("请录入起始 和 结束日期")
Else
DataTables("日报表").LoadFilter = "[日期] >= #" & StartDate & "# And [日期] <= #" & EndDate & "# "
DataTables("日报表").Load()
Dim nms As List(of String) = DataTables("日报表").GetUniqueValues("","所属")
For Each nm As String In nms
Dim Book As New XLS.Book(ProjectPath & "Attachments\日统计表-表格.xls")
Dim d As Date = DataTables("日报表").Compute("Max(日期)", "所属 = '" & nm & "'")
Dim fl As String = ProjectPath & "Attachments\" & nm &"-"& d.Year &"年"& d.Month &"月"&"-日统计表.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Sheet(6, 14).Value = "<所属 = '" & nm & "'>"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Next
End If