Dim EelApp As Excel.Application Dim EelWork As Excel.Workbook Dim EelSheel As Excel.Worksheet
Private Sub Command1_Click() Set EelApp = New Excel.Application EelApp.Visible = True Set EelWork = EelApp.Workbooks.Open("C:\打印.xls") Set EelSheel = EelWork.Worksheets(1) EelSheel.PrintPreview '打印预览 End Sub
Private Sub Form_Unload(Cancel As Integer) EelApp.Workbooks.Close EelApp.Quit Set EelSheel = Nothing Set EelWork = Nothing Set EelApp = Nothing End Sub