|
如下为调用Excel打印的一小段代码供参考:
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") '"c:\reprot\temp.xls"为你做的表格
Set xlSheet = xlBook.Worksheets(1)
xlSheet.Cells(3, 1) = "制表日期:" + "12" + " 月"
'以上只更改了一个单元格内的数据,可根据需要无限次加入
xlBook.Save
xlSheet.PrintPreview '如果是要打印,只要把 PrintPreview 改为 PrintOut
xlBook.close
xlApp.Quit
End Sub
|
|