我想要做的是製作VBA代碼,它將隱藏和顯示圖表上的單個系列。我知道如何在Excel中編寫VBA代碼,但不知道要在PPT VBA中重寫相同的代碼。如何使excel VBA代碼適應PPT VBA?
我有這樣的代碼在Excel VBA:
Sub FirstSer()
Dim cht As Chart
Dim ser As Series
'Retrieve our chart and seriescollection objects'
Set cht = Worksheets("Sheet1").ChartObjects("Chart 1").Chart
Set ser = cht.SeriesCollection(1)
'Set the first series line to be hidden'
With ser.Format.Line
If .Visible = msoTrue Then
.Visible = msoFalse
ser.Name = vbNullString
Else
.Visible = msoTrue
ser.Name = "First"
End If
End With
End Sub
我怎麼能寫在PowerPoint VBA相同的代碼? 我試圖在類似的帖子中找到解決方案,但是每個帖子都考慮到了特定的代碼,這些代碼很難適應我的代碼,因爲我是VBA中的新手。