rivateSubPrintFunc()onerrorgotoPrintFunc_ErrDimCtAsObjectSetex=CreateObject("Excel.Application")'增加工作表ex.Workbooks.Add'输出数据ex.Range("A1").Value="系列1"
方法/步骤
1、ex.Ran壹执慵驾ge("A2").Value=8ex.Range("A3"稆糨孝汶;).Value=16ex.Range("A4").Value=7ex.Range("A5").Value=22ex.Range("A6").Value=13ex.Range("A7").Value=15ex.Range("A8").Value=11ex.Range("B1").Value="系列2"
2、x.Range("B2").V瞢铍库祢alue=5ex.Range("B3媪青怍牙").Value=6ex.Range("B4").Value=17ex.Range("B5").Value=10ex.Range("B6").Value=3ex.Range("B7").Value=9ex.Range("B8").Value=16'设定表格样式ex.Range("A1","B8").Borders.LineStyle=xlContinuous
3、ex.Cells(,1).ColumnWidth=25ex.Cells(,2).ColumnWidth=25’插入折线图
4、SetCt=ex.Worksheets("sheet1").ChartObjects.Add(0,130,350,250)Ct.Chart.ChartWizardSource:=ex.Worksheets("sheet1").Range("A2:B8"),_gallery:=xlLine,Title:="NewChart"ex.Visible=True
5、'打印预揽ex.ActiveWindow.SelectedSheets.PrintPreview'关闭EXCEL
6、ex.Visible=Falseex.Worksheets("sheet1").ChartObjects.Deleteex.ActiveWorkbook.Closesavechanges:=False
7、PrintFunc_Err:Setex=NothingSetCt=NothingendSub