PrivateSubCFixPicture_Initialize()dtpTime.Value=NowEndSubPrivateSubCFixPicture_KeyDown(ByValKeyCodeAsLong,ByValShiftAsLong,ContinueProcessingAsBoolean)EndSubPrivateSubCommandButton1_Click()DimstrDateAsStringDimstrMonthAsStringstrDate=Format(dtpTime,yyyy-MM-dd)strMonth=Format(dtpTime,yyyy-MM)'日报IfMe.optMonth.Value=FalseThenIfMe.optDay.Value=TrueThenWebReport.NavigateD:\REPORT\日报表\日报表&strDate&.htm'显示ElseWebReport.NavigateD:\REPORT\日报表\空白报表&strDate&.htm'显示EndIfEndIf'月报IfMe.optDay.Value=FalseThenIfMe.optMonth.Value=TrueThenWebReport.NavigateD:\REPORT\月报表\月报表&strMonth&.htm'显示ElseWebReport.NavigateD:\REPORT\月报表\空白报表&strMonth&.htm'显示EndIfEndIfEndSubPrivateSubCommandButton2_Click()OnErrorResumeNext'日报页面设置IfMe.optDay.Value=TrueThenPrintSet0.5,0.5,0.5,0.5EndIf'月报页面设置IfMe.optMonth.Value=TrueThenPrintSet0.5,0.5,0.5,0.5EndIfMe.WebReport.ExecWB6,OLECMDEXECOPT_PROMPTUSEREndSubPrivateSuboptDay_Click()Me.optDay.Value=True'日报Me.optMonth.Value=False'月报Me.dtpTime.CustomFormat=yyyy-MM-dd'修改时间格式dtpTime.Value=NowEndSubPrivateSuboptMonth_Click()Me.optDay.Value=False'日报Me.optMonth.Value=True'月报Me.dtpTime.CustomFormat=yyyy-MM'修改时间格式dtpTime.Value=NowEndSub打印设置PrivateSubPrintSet(sBottomAsString,strTopAsString,sLeftAsString,sMargin_rightAsString)Dimhkey_root,hkey_path,hkey_keyAsStringDimRegWshAsObjecthkey_root=HKEY_CURRENT_USERhkey_path=\Software\Microsoft\InternetExplorer\PageSetup'//设置网页打印的页眉页脚为空SetRegWsh=CreateObject(WScript.Shell)hkey_key=\header'页眉RegWsh.RegWritehkey_root+hkey_path+hkey_key,hkey_key=\footer'页脚RegWsh.RegWritehkey_root+hkey_path+hkey_key,hkey_key=\margin_bottom'下页边距RegWsh.RegWritehkey_root+hkey_path+hkey_key,sBottom'hkey_key=\margin_top'上页边距RegWsh.RegWritehkey_root+hkey_path+hkey_key,strTop'hkey_key=\margin_left'左页边距RegWsh.RegWritehkey_root+hkey_path+hkey_key,sLeft'hkey_key=\margin_right'右页边距RegWsh.RegWritehkey_root+hkey_path+hkey_key,sMargin_right''打印EndSub其中日报和月报为控件报表时间为控件WebReport控件新建调度ReportPrivateSubreport_OnTimeOut(ByVallTimerIdAsLong)OnErrorResumeNextDimstrDateTimeAsStringDimstrDateAsStringDimstrHourMinuteAsStringDimiRowAsIntegerDimstrTemplateNameAsStringstrDateTime=Format(Now(),yyyy-MM-ddhh:mm:ss)strDate=Left(strDateTime,10)strHourMinute=Right(Left(strDateTime,13),2)&:00iRow=Right(Left(strDateTime,13),2)DimisCreateAsBooleanSetfs=CreateObject(Scripting.FileSystemObject)isCreate=fs.FileExists(D:\REPORT\日报表\日报表&strDate&.htm)Setfs=NothingIfisCreateThenstrTemplateName=(D:\REPORT\日报表\日报表&strDate&.htm)ElsestrTemplateName=D:\REPORT\日报表&.htmEndIfSetmsExcel=CreateObject(Excel.Application)WithmsExcel.visible=True.Workbooks.OpenstrTemplateName,,False.ActiveWorkbook.ActiveSheet.Select.DisplayAlerts=False.Wait(Now()+0.00002)EndWith'写日期msExcel.Worksheets(1).Cells(1,8).Value=strDate'写数据msExcel.Worksheets(1).Cells(iRow+6,2).Value=readvalue(DAYJSLJ1)msExcel.Worksheets(1).Cells(iRow+6,4).Value=readvalue(DAYJSLJ2)msExcel.Worksheets(1).Cells(iRow+6,6).Value=readvalue(DAYJSLJ3)msExcel.Worksheets(1).Cells(iRow+6,8).Value=readvalue(DAYJSLJ4)msExcel.Worksheets(1).Cells(iRow+6,10).Value=readvalue(DAYJSLJ1)+readvalue(DAYJSLJ2)+readvalue(DAYJSLJ3)+readvalue(DAYJSLJ4)'保存报表文件DimstrSaveNameAsStringstrSaveName=D:\REPORT\日报表\日报表&strDate&.htmmsExcel.ActiveWorkbook.SaveAs(D:\REPORT\日报表\日报表&strDate&.htm)msExcel.QuitEndSubReport1PrivateSubreport1_OnTimeOut(ByVallTimerIdAsLong)OnErrorResumeNextDimstrDateTimeAsStringDimstrMonthAsStringDimstrHourMinuteAsStringDimiRowAsIntegerDimstrTemplateNameAsStringstrDateTime=Format(Now(),yyyy-MM-ddhh:mm:ss)strMonth=Left(strDateTime,7)strHourMinute=Right(Left(strDateTime,13),2)&:00iRow=Right(Left(strDateTime,10),2)DimisCreateAsBooleanSetfs=CreateObject(Scripting.FileSystemObject)isCreate=fs.FileExists(D:\REPORT\月报表\月报表&strMonth&.htm)Setfs=NothingIfisCreateThenstrTemplateName=(D:\REPORT\月报表\月报表&strMonth&.htm)ElsestrTemplateName=D:\REPORT\月报表&.htmEndIfSetmsExcel=CreateObject(Excel.Application)WithmsExcel.visible=False.Workbooks.OpenstrTemplateName,,False.ActiveWorkbook.ActiveSheet.Select.DisplayAlerts=False.Wait(Now()+0.00002)EndWith'写日期msExcel.Worksheets(1).Cells(1,8).Value=strMonth'写数据msExcel.Worksheets(1).Cells(iRow+2,2).Value=readvalue(DAYJSLJ1)msExcel.Worksheets(1).Cells(iRow+2,4).Value=readvalue(DAYJSLJ2)msExcel.Worksheets(1).Cells(iRow+2,6).Value=readvalue(DAYJSLJ3)msExcel.Worksheets(1).Cells(iRow+2,8).Value=readvalue(DAYJSLJ4)msExcel.Worksheets(1).Cells(iRow+2,10).Value=readvalue(DAYJSLJ4)+readvalue(DAYJSLJ1)+readvalue(DAYJSLJ2)+readvalue(DAYJSLJ3)DimstrtempAsIntegerstrtemp=3msExcel.Worksheets(1).Cells(34,2).Value=0msExcel.Worksheets(1).Cells(34,4).Value=0msExcel.Worksheets(1).Cells(34,6).Value=0msExcel.Worksheets(1).Cells(34,8).Value=0msExcel.Worksheets(1).Cells(34,10).Value=0DoWhilestrtemp=33msExcel.Worksheets(1).Cells(34,2).Value=msExcel.Worksheets(1).Cells(34,2).Value+msExcel.Worksheets(1).Cells(strtemp,2).ValuemsExcel.Worksheets(1).Cells(34,4).Value=msExcel.Worksheets(1).Cells(34,4).Value+msExcel.Worksheets(1).Cells(strtemp,4).ValuemsExcel.Worksheets(1).Cells(34,6).Value=msExcel.Worksheets(1).Cells(