如何用VB将一固定文件格式调用excel打印
来源:百度知道 编辑:UC知道 时间:2024/05/15 11:22:02
不用VB也可以```有没有其它简单的办法
如何转换呢?
vb.net,vb的也差不多。
Dim oExcel As New Excel.Application
Dim obook As Excel.Workbook
Dim oSheet As Excel.Worksheet
Try
obook = oExcel.Workbooks.Add '.Open(file)
oSheet = obook.Worksheets(1)
oSheet.Name = "XXXX"
Dim r As Integer, c As Integer
Dim rCount As Integer
Dim cCount As Integer
rCount = Me.DataSet21.Tables("GSPD").Rows.Count
cCount = Me.DataSet21.Tables("GSPD").Columns.Count()
For c = 1 To cCount
oSheet.Cells(1, c) = Me.DataSet21.Tables("GSPD").Columns(c - 1).Caption '设置列标题
Next
c = 0 : r = 0
For r = 1 To rCount
For c = 1 To cCount
oSheet.Cells(r + 1, c) = CStr(Me.DataSet21.Tables("GSPD").Rows(r