How to make a complex statement in Access - Excel Output Substation

zhaozj2021-02-16  45

How to make a complex statement - using Excel output complex report

How to make a complex statement - using the Excel Output Supreme Reports Read this article first to remind everyone, Access itself has strong practical and powerful features. Only when you discover all its features but still can't Please use the Excel output report when you meet your special requirements for your report. Obviously, the first weakness of using Excel output reports must open Access and Excel at the same time, you have to install Access and Excel on a machine, of course, if you have the same CPU and 256M on 966MHz When memory and large-capacity hard drive, then you don't have to consider it, continue. First find the VBA programming interface and find the Tools menu and click the "References ..." menu item, find the "Existing Reference" list in the "Reference" form that pops up, in named "Microsoft Excel X.0 Object Tell in front of the project of library. Second, you have to do a blank Excel spreadsheet, set the display font, border, print paper, etc. and store it. (In the following example, the table is named "Temp.xls") of course, it is also possible to use blank Excel files directly, but you have to program automatically generate some contents such as table border, background color, cell format, etc., these involves Excel. Programming, I will later narrate in the Excel column in the Excel column. Then you can make your own print preview form in Access, schedule 2 command buttons in the form, enter the following code in the Click event called the preview of the 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: /reprot/temp.xls") set xlsheet = xlbook.worksheets (1) xlsheet.cells (3, 1) = "Table Date: " 12 " " Month "'above only changed one Data within the cell, can join XLbook.save xlsheet.printpreview in the need if you need to print, just change the printpreview to Print Xlbook.close xlapp.quitend sub OK, then you can click the button to see the generated How is the table.

转载请注明原文地址:https://www.9cbs.com/read-24501.html

New Post(0)