PPT内用动态图表但组合框出错
PPT内用动态图表但组合框出错,求助大神解答 按钮放图上面就好 还是不懂,你能做个放上来不? 组合框的代码我是复制网上的:Option Explicit'声明公共变量
Dim Wb As Object, Sh As Object, SouceRng As Object, TarCell As Object
'当控件获得焦点时运行
Private Sub ComboBox1_GotFocus()
Dim i As Integer
'设置Wb为内嵌的Excel工作薄,Sh为指定工作表,SouceRng和TarCell为指定单元格区域
Set Wb = Me.Shapes(1).OLEFormat.Object 'Me表示正在播放的Slide
Set Sh = Wb.worksheets("sheet1")
Set SouceRng = Sh.Range("B1:D1")
Set TarCell = Sh.Range("F1")
With ComboBox1
'先清除列表
If .ListCount > 0 Then
.ListIndex = -1
For i = .ListCount - 1 To 0 Step -1
.RemoveItem i
Next i
End If
'加入列表项
For i = 1 To SouceRng.Count
.AddItem SouceRng.offset(0, i - 1).Range("A1")
Next i
'选择第一项
.ListIndex = 0
'修改TarCell单元格中的值
TarCell = .Value
End With
End Sub
Private Sub ComboBox1_LostFocus()
Set TarCell = Nothing
Set SouceRng = Nothing
Set Sh = Nothing
Set Wb = Nothing
End Sub
Private Sub ComboBox1_Change()
'改变内嵌工作薄中相应单元格的值
TarCell = ComboBox1.Value
End Sub
但是就是做不出来
页:
[1]