如何使导出的数据,直接显示打印预览而不显示EXCEL窗体,在线等待!
解决方案 »
- vb如何实现QQ的文件传输
- 转贴给分〖◆〗这样的画图效果,怎样用函数或者控件实现?帮忙好吗?〖◆〗
- 关于MSHFLEXGRID控件的列的位置...
- DataGrid 的问题!!
- 大家幫幫忙,這個語句錯在哪,查詢結老為空.
- VScroll 和 DataGrid 的垂直滚动条建立关联???
- sz..db 文件是属于那一个数据库类型?
- vb 串口数据处理问题,求大神指点
- 能否在运行中指定dataenvironment的command所连接的表?
- Either BOF or EOF is True, or the current record has been deleted.问题求助
- 怎么给控件MSFlexGrid和dbgrid控件的每行换一种颜色?
- 一大早就来提问。关于程序打包,谢谢回答。
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1) With Rs_Dzgl_Receipt
If .RecordCount < 1 Then
MsgBox ("没有记录!")
Exit Sub
End If
xlSheet.Cells(1, 4).Value = .Fields("bt")
xlSheet.Cells(2, 1).Value = .Fields("invoice")
xlSheet.Cells(2, 9).Value = .Fields("packdate")
xlSheet.Cells(3, 1).Value = .Fields("")
'合并单元格
Dim nIcol As Integer
xlSheet.Range(xlSheet.Cells(3, 1), xlSheet.Cells(5, 9)).Select
With xlApp.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
xlSheet.Range(xlSheet.Cells(1, 1), xlSheet.Cells(1, 9)).Select
With xlApp.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
'网格线
With xlSheet
.Range(.Cells(1, 1), .Cells(1, 9)).Font.Name = "黑体"
'设标题为黑体字
.Range(.Cells(1, 1), .Cells(1, 9)).Font.Bold = True
'标题字体加粗
.Range(.Cells(1, 1), .Cells(1, 9)).Borders.LineStyle = xlContinuous
'设表格边框样式
End With
xlApp.Application.Visible = False
'打印预览
xlSheet.PrintPreview
' xlApp.Application.Quit
' xlApp.Quit
End With
我的做法是先保存一個臨時文件,然後調用PrintPreview