Before reading this article, I would like to remind you that the Access reports are also very practical and powerful, use Excel to output reports only when you discover all of its functions but still cannot meet your special requirements on reports. Obviously, the first weakness of using Excel to output reports is that both Access and
Before reading this article, I would like to remind you that the Access reports are also very practical and powerful, use Excel to output reports only when you discover all of its functions but still cannot meet your special requirements on reports. Obviously, the first weakness of using Excel to output reports is that both Access and
Before reading this article, we should first remind you that the AccessReportsIt is also highly practical and powerful. Only when you discover all of its functions can youReportsUse Excel for output only when special requirementsReports. Obviously, use Excel to outputReportsThe first weakness is that you must open Access and Excel at the same time (of course, you must install Access and Excel at the same time on a machine ), of course, if you have a CPU, 966 M memory, and a large-capacity hard disk that works at 256 MHz like you, you don't have to worry about it. Continue.
First, find the VBA programming interface, find the "tool" menu, and click "reference... "menu item, find the" existing reference "list in the pop-up" Reference "form, and check the box in front of the project named" Microsoft Excel x.0 Object Library.
Second, you need to prepare a blank Excel spreadsheet, set the display font, border, printing paper, and so on, and save it to the disk. (In the following example, the table name is "temp.xls".) Of course, you can directly use a blank Excel file, however, you need to program to automatically generate the table border, background color, cell format, and other content. This involves Excel programming. I will explain it in detail in the Excel column in the future. I will not talk about it here.
Then you canProductionYou have printed and previewed the form by yourself. In the form, arrange two command buttons and enter the following code in the click event named preview:
Private Sub ExcelPreview_Click ()
Dim xlApp As Excel. Application
Dim xlBook As Workbook, xlSheet As Worksheet
Set xlApp = CreateObject ("Excel. Application ")
Set xlApp = New Excel. Application
XlApp. Visible = True
Set xlBook = xlApp. Workbooks. Open ("c: reprottemp.xls ")
Set xlSheet = xlBook. Worksheets (1)
XlSheet. Cells (3, 1) = "tabulation Date:" + "12" + "month"
'The above only changes the data in a cell and can be added as needed infinitely
XlBook. Save
XlSheet. PrintPreview
XlBook. close
XlApp. Quit
End Sub
OK, then you can click this button to see how the table is generated.