📄 +i
字号:
if IsNumeric(rds1.Recordset.fields(5)) = true Then
xlSheet.Cells(k+3,12) = trim(cstr(rds1.Recordset.fields(5)))
else
xlSheet.Cells(k+3,12) = trim(cstr(rds1.Recordset.fields(5)))
End If
end if
'============================================
If rds1.Recordset.fields(6)<>0 then
if IsNumeric(rds1.Recordset.fields(6)) = true Then
xlSheet.Cells(k+3,13) = trim(cstr(rds1.Recordset.fields(6)))
else
xlSheet.Cells(k+3,13) = trim(cstr(rds1.Recordset.fields(6)))
End If
end if
end if
'============================
if i=2 then
If isnull(rds1.Recordset.fields(0))=false then
if rds1.Recordset.fields(0)=oldclass then
else
if IsNumeric(rds1.Recordset.fields(0)) = true Then
xlSheet.Cells(k+3,14) = trim(cstr(rds1.Recordset.fields(0)))
else
xlSheet.Cells(k+3,14) = trim(cstr(rds1.Recordset.fields(0)))
End If
end if
end if
'====================
If isnull(rds1.Recordset.fields(2))=false then
if IsNumeric(rds1.Recordset.fields(2)) = true Then
xlSheet.Cells(k+3,15) = trim(cstr(rds1.Recordset.fields(2)))
else
xlSheet.Cells(k+3,15) = trim(cstr(rds1.Recordset.fields(2)))
End If
end if
'=============================
If rds1.Recordset.fields(3)<>0 then
if IsNumeric(rds1.Recordset.fields(3)) = true Then
xlSheet.Cells(k+3,16) = trim(cstr(rds1.Recordset.fields(3)))
else
xlSheet.Cells(k+3,16) = trim(cstr(rds1.Recordset.fields(3)))
End If
end if
'=================================
If rds1.Recordset.fields(4)<>0 then
if IsNumeric(rds1.Recordset.fields(4)) = true Then
xlSheet.Cells(k+3,17) = trim(cstr(rds1.Recordset.fields(4)))
else
xlSheet.Cells(k+3,17) = trim(cstr(rds1.Recordset.fields(4)))
End If
end if
'=============================
If rds1.Recordset.fields(5)<>0 then
if IsNumeric(rds1.Recordset.fields(5)) = true Then
xlSheet.Cells(k+3,18) = trim(cstr(rds1.Recordset.fields(5)))
else
xlSheet.Cells(k+3,18) = trim(cstr(rds1.Recordset.fields(5)))
End If
end if
'============================================
If rds1.Recordset.fields(6)<>0 then
if IsNumeric(rds1.Recordset.fields(6)) = true Then
xlSheet.Cells(k+3,19) = trim(cstr(rds1.Recordset.fields(6)))
else
xlSheet.Cells(k+3,19) = trim(cstr(rds1.Recordset.fields(6)))
End If
end if
end if
'===========================
if i=3 then
If isnull(rds1.Recordset.fields(0))=false then
if rds1.Recordset.fields(0)=oldclass then
else
if IsNumeric(rds1.Recordset.fields(0)) = true Then
xlSheet.Cells(k+3,20) = trim(cstr(rds1.Recordset.fields(0)))
else
xlSheet.Cells(k+3,20) = trim(cstr(rds1.Recordset.fields(0)))
End If
end if
end if
'====================
If isnull(rds1.Recordset.fields(2))=false then
' msgbox isnull(rds1.Recordset.fields(2))
if IsNumeric(rds1.Recordset.fields(2)) = true Then
xlSheet.Cells(k+3,21) = trim(cstr(rds1.Recordset.fields(2)))
else
xlSheet.Cells(k+3,21) = trim(cstr(rds1.Recordset.fields(2)))
End If
end if
'=============================
If rds1.Recordset.fields(3)<>0 then
if IsNumeric(rds1.Recordset.fields(3)) = true Then
xlSheet.Cells(k+3,22) = trim(cstr(rds1.Recordset.fields(3)))
else
xlSheet.Cells(k+3,22) = trim(cstr(rds1.Recordset.fields(3)))
End If
end if
'=================================
If rds1.Recordset.fields(4)<>0 then
' msgbox isnull(rds1.Recordset.fields(4))
if IsNumeric(rds1.Recordset.fields(4)) = true Then
xlSheet.Cells(k+3,23) = trim(cstr(rds1.Recordset.fields(4)))
else
xlSheet.Cells(k+3,23) = trim(cstr(rds1.Recordset.fields(4)))
End If
end if
'=============================
If rds1.Recordset.fields(5)<>0 then
' msgbox isnull(rds1.Recordset.fields(5))
if IsNumeric(rds1.Recordset.fields(5)) = true Then
xlSheet.Cells(k+3,24) = trim(cstr(rds1.Recordset.fields(5)))
else
xlSheet.Cells(k+3,24) = trim(cstr(rds1.Recordset.fields(5)))
End If
end if
'============================================
If rds1.Recordset.fields(6)<>0 then
' msgbox isnull(rds1.Recordset.fields(6))
if IsNumeric(rds1.Recordset.fields(6)) = true Then
xlSheet.Cells(k+3,25) = trim(cstr(rds1.Recordset.fields(6)))
else
xlSheet.Cells(k+3,25) = trim(cstr(rds1.Recordset.fields(6)))
End If
end if
end if
'==========================
k=k+1
'保存旧的班号值,可以在后面判断班号是不是都一样,如果一样,则不打印出
oldclass=rds1.Recordset.fields(0)
rds1.Recordset.movenext
if j=19 then
k=1
end if
next
next
next
wend
end sub
'===============================================================
'按班号进行打印
sub printclass()
if rds1.Recordset.recordcount<=0 then
exit sub
end if
class_print.disabled = true
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
'j=0
rds1.Recordset.movefirst
while not rds1.Recordset.eof
for k=j+1 to j+23
if len(rtrim(weekstartno.value))>0 then
xlSheet.Cells(k, 10) = yearno.value+"-"+endyearno.value+"学年度"+termno.value+"第"+weekstartno.value+"、"+weekendno.value+"周"
xlSheet.Cells(k+1,10) ="海南省琼海师范学校学生考勤情况统计表"
else
xlSheet.Cells(k, 10) = yearno.value+"-"+endyearno.value+"学年度"+termno.value+"("+yearno.value+"年"+monthstartno.value+"月"+daystartno.value+"日"+"--"+monthendno.value+"月"+daysendno.value+"日)"
xlSheet.Cells(k+1,10) ="海南省琼海师范学校学生考勤情况统计表"
end if
for i=0 to 3
'当I=0时及第一次印时,则行已固定
if i=0 then
' msgbox rds1.Recordset.fields(0).name
xlsheet.cells(k+2,2)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,3)=rds1.Recordset.fields(1).name+"(节)"
xlsheet.cells(k+2,4)=rds1.Recordset.fields(2).name+"(节)"
xlsheet.cells(k+2,5)=rds1.Recordset.fields(3).name+"(次)"
xlsheet.cells(k+2,6)=rds1.Recordset.fields(4).name+"(次)"
end if
'//////////
if i=1 then
xlsheet.cells(k+2,7)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,8)=rds1.Recordset.fields(1).name+"(节)"
xlsheet.cells(k+2,9)=rds1.Recordset.fields(2).name+"(节)"
xlsheet.cells(k+2,10)=rds1.Recordset.fields(3).name+"(次)"
xlsheet.cells(k+2,11)=rds1.Recordset.fields(4).name+"(次)"
end if
'///////////////////////
if i=2 then
xlsheet.cells(k+2,12)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,13)=rds1.Recordset.fields(1).name+"(节)"
xlsheet.cells(k+2,14)=rds1.Recordset.fields(2).name+"(节)"
xlsheet.cells(k+2,15)=rds1.Recordset.fields(3).name+"(次)"
xlsheet.cells(k+2,16)=rds1.Recordset.fields(4).name+"(次)"
end if
'//////////////////////
if i=3 then
xlsheet.cells(k+2,17)=rds1.Recordset.fields(0).name
xlsheet.cells(k+2,18)=rds1.Recordset.fields(1).name+"(节)"
xlsheet.cells(k+2,19)=rds1.Recordset.fields(2).name+"(节)"
xlsheet.cells(k+2,20)=rds1.Recordset.fields(3).name+"(次)"
xlsheet.cells(k+2,21)=rds1.Recordset.fields(4).name+"(次)"
end if
'//////////////
for j=0 to 19
if rds1.Recordset.eof=true then
exit sub
end if
'================
if i=0 then
If isnull(rds1.Recordset.fields(0))=false then
if IsNumeric(rds1.Recordset.fields(0)) = true Then
xlSheet.Cells(k+3,2) = trim(cstr(rds1.Recordset.fields(0)))
else
xlSheet.Cells(k+3,2) = trim(cstr(rds1.Recordset.fields(0)))
End If
end if
'====================
If rds1.Recordset.fields(1)<>0 then
if IsNumeric(rds1.Recordset.fields(1)) = true Then
xlSheet.Cells(k+3,3) = trim(cstr(rds1.Recordset.fields(1)))
else
xlSheet.Cells(k+3,3) = trim(cstr(rds1.Recordset.fields(1)))
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -