导出到EXCEL中再打印 Set xlapp = CreateObject("excel.application")
If (xlapp = Null) Then MsgBox ("无法创建Excel对象,可能您的机子未安装Excel") End If
Dim xlBook As Object Dim xlSheet As Object xlapp.Visible = True Set xlBook = xlapp.Workbooks.Add() Set xlSheet = xlBook.Worksheets(1) j = infolist.Columns.Count xlSheet.Cells(1, 1) = rswage!Fields(年份) & "年" & rswage!Fields(月份) & "月" & "员工明细工资表" i = 1 For n = 1 To j - 1 If infolist.Columns(n).Visible = True Then xlSheet.Cells(2, i) = infolist.Columns(n).Caption i = i + 1 End If Next n rswage3.MoveFirst m = 0 Do While Not rswage3.EOF i = 1 For n = 1 To j - 1 If infolist.Columns(n).Visible = True Then xlSheet.Cells(m + 3, i) = infolist.Columns(n).Value i = i + 1 End If Next n rswage3.MoveNext m = m + 1 Loop Exit Sub
沒有其它的了
Set xlapp = CreateObject("excel.application")
If (xlapp = Null) Then
MsgBox ("无法创建Excel对象,可能您的机子未安装Excel")
End If
Dim xlBook As Object
Dim xlSheet As Object
xlapp.Visible = True Set xlBook = xlapp.Workbooks.Add()
Set xlSheet = xlBook.Worksheets(1)
j = infolist.Columns.Count
xlSheet.Cells(1, 1) = rswage!Fields(年份) & "年" & rswage!Fields(月份) & "月" & "员工明细工资表"
i = 1
For n = 1 To j - 1
If infolist.Columns(n).Visible = True Then
xlSheet.Cells(2, i) = infolist.Columns(n).Caption
i = i + 1
End If
Next n
rswage3.MoveFirst
m = 0
Do While Not rswage3.EOF
i = 1
For n = 1 To j - 1
If infolist.Columns(n).Visible = True Then
xlSheet.Cells(m + 3, i) = infolist.Columns(n).Value
i = i + 1
End If
Next n
rswage3.MoveNext
m = m + 1
Loop
Exit Sub