Private Sub Command1_Click() Dim eApp As New Excel.Application Dim eWork As Excel.Workbook Dim eSheet As Excel.Worksheet Set eWork = eApp.Workbooks.Open(App.Path + "\book1.xls") Set eSheet = eWork.Worksheets(1) eSheet.Range("A1:D1").Select
With eWork .Charts.Add .ActiveChart.ChartType = xlLineStacked .ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:D1"), PlotBy:=xlRows .ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" End With With eWork.ActiveChart .HasTitle = False .Axes(xlCategory, xlPrimary).HasTitle = False .Axes(xlValue, xlPrimary).HasTitle = False End With eApp.Visible = True eApp.ActiveWindow.SelectedSheets.PrintPreview eApp.Quit Set eSheet = Nothing Set eWork = Nothing Set eApp = Nothing End Sub用excel可以实现,因为excel有强大的图表 测试数据为: A1 1000 B1 100 C1 260 D1 80000楼主自己感受一下咯,如是要换样式或其它设置,你可以在excel中录制一段宏,看看宏代码及可
Dim eWork As Excel.Workbook
Dim eSheet As Excel.Worksheet
Set eWork = eApp.Workbooks.Open(App.Path + "\book1.xls")
Set eSheet = eWork.Worksheets(1)
eSheet.Range("A1:D1").Select
With eWork
.Charts.Add
.ActiveChart.ChartType = xlLineStacked
.ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:D1"), PlotBy:=xlRows
.ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
End With
With eWork.ActiveChart
.HasTitle = False
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With
eApp.Visible = True
eApp.ActiveWindow.SelectedSheets.PrintPreview
eApp.Quit
Set eSheet = Nothing
Set eWork = Nothing
Set eApp = Nothing
End Sub用excel可以实现,因为excel有强大的图表
测试数据为:
A1 1000 B1 100 C1 260 D1 80000楼主自己感受一下咯,如是要换样式或其它设置,你可以在excel中录制一段宏,看看宏代码及可