养生 装修 购物 美食 感冒 便秘 营销 加盟 小吃 火锅 管理 创业 搭配 减肥 培训 旅游

用EXCEL来打印报表并生成折线图

时间:2024-10-20 08:35:20

rivateSubPrintFunc()onerrorgotoPrintFunc_ErrDimCtAsObjectSetex=CreateObject("Excel.Application")'增加工作表ex.Workbooks.Add'输出数据ex.Range("A1").Value="系列1"

用EXCEL来打印报表并生成折线图

方法/步骤

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"

用EXCEL来打印报表并生成折线图

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

用EXCEL来打印报表并生成折线图

3、ex.Cells(,1).ColumnWidth=25ex.Cells(,2).ColumnWidth=25’插入折线图

用EXCEL来打印报表并生成折线图

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

用EXCEL来打印报表并生成折线图

5、'打印预揽ex.ActiveWindow.SelectedSheets.PrintPreview'关闭EXCEL

用EXCEL来打印报表并生成折线图

6、ex.Visible=Falseex.Worksheets("sheet1").ChartObjects.Deleteex.ActiveWorkbook.Closesavechanges:=False

用EXCEL来打印报表并生成折线图

7、PrintFunc_Err:Setex=NothingSetCt=NothingendSub

用EXCEL来打印报表并生成折线图

© 一点知识