以下為關鍵部分"開啟Set sf1 = CreateObject("Excel.Application")sf1.Workbooks.AddSet sf2 = sf1.Workbooks(1)Set sf3 = sf2.ActiveSheet"作圖 Range("A1:E5").Select Charts.Add ActiveChart.ChartType = xl3DColumn ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:E5") ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" ActiveWindow.Visible = False‘第二個圖 Charts.Add ActiveChart.ChartType = xl3DPieExploded ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:E5"), PlotBy:= _ xlRows ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" Windows("Book1").SmallScroll Down:=-9 ActiveWindow.Visible = False
以下為關鍵部分"開啟Set sf1 = CreateObject("Excel.Application")sf1.Workbooks.AddSet sf2 = sf1.Workbooks(1)Set sf3 = sf2.ActiveSheet"作圖 Range("A1:E5").Select Charts.Add ActiveChart.ChartType = xl3DColumn ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:E5") ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" ActiveWindow.Visible = False‘第二個圖 Charts.Add ActiveChart.ChartType = xl3DPieExploded ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:E5"), PlotBy:= _ xlRows ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" Windows("Book1").SmallScroll Down:=-9 ActiveWindow.Visible = False