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 you must open both Access and Excel (
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 you must open both Access and Excel (
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 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 can create your own print preview form in Access, arrange two command buttons in the form, and enter the following code in the click Event of the button 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
,