TextBox不支持VBA PPT中的属性和Menthod
这是我的代码
Sub Loadde()
If Slide3.Shapes("MA_VONG") = 1 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide6.Shapes("1").TextFrame.TextRange
Slide5.Shapes("Q2").TextFrame.TextRange = Slide6.Shapes("2").TextFrame.TextRange
Slide5.Shapes("Q3").TextFrame.TextRange = Slide6.Shapes("3").TextFrame.TextRange
Slide5.Shapes("Q4").TextFrame.TextRange = Slide6.Shapes("4").TextFrame.TextRange
Slide5.Shapes("Q5").TextFrame.TextRange = Slide6.Shapes("5").TextFrame.TextRange
ElseIf Slide3.Shapes("MA_VONG") = 2 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide7.Shapes("1").TextFrame.TextRange
Slide5.Shapes("Q2").TextFrame.TextRange = Slide7.Shapes("2").TextFrame.TextRange
Slide5.Shapes("Q3").TextFrame.TextRange = Slide7.Shapes("3").TextFrame.TextRange
Slide5.Shapes("Q4").TextFrame.TextRange = Slide7.Shapes("4").TextFrame.TextRange
Slide5.Shapes("Q5").TextFrame.TextRange = Slide7.Shapes("5").TextFrame.TextRange
End If
End Sub
,它可以正常工作,但是在那之后,它显示出一个错误,即QS(幻灯片5中)不支持 我试图使其更简单,但仍然不起作用。
Sub Loadde()
If Slide3.Shapes("MA_VONG") = 1 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide6.Shapes("1").TextFrame.TextRange
Slide5.Shapes("Q2").TextFrame.TextRange = Slide6.Shapes("2").TextFrame.TextRange
Slide5.Shapes("Q3").TextFrame.TextRange = Slide6.Shapes("3").TextFrame.TextRange
Slide5.Shapes("Q4").TextFrame.TextRange = Slide6.Shapes("4").TextFrame.TextRange
Slide5.Shapes("Q5").TextFrame.TextRange = Slide6.Shapes("5").TextFrame.TextRange
End If
End Sub
有人可以向我解释此代码怎么了?
Here is my code
Sub Loadde()
If Slide3.Shapes("MA_VONG") = 1 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide6.Shapes("1").TextFrame.TextRange
Slide5.Shapes("Q2").TextFrame.TextRange = Slide6.Shapes("2").TextFrame.TextRange
Slide5.Shapes("Q3").TextFrame.TextRange = Slide6.Shapes("3").TextFrame.TextRange
Slide5.Shapes("Q4").TextFrame.TextRange = Slide6.Shapes("4").TextFrame.TextRange
Slide5.Shapes("Q5").TextFrame.TextRange = Slide6.Shapes("5").TextFrame.TextRange
ElseIf Slide3.Shapes("MA_VONG") = 2 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide7.Shapes("1").TextFrame.TextRange
Slide5.Shapes("Q2").TextFrame.TextRange = Slide7.Shapes("2").TextFrame.TextRange
Slide5.Shapes("Q3").TextFrame.TextRange = Slide7.Shapes("3").TextFrame.TextRange
Slide5.Shapes("Q4").TextFrame.TextRange = Slide7.Shapes("4").TextFrame.TextRange
Slide5.Shapes("Q5").TextFrame.TextRange = Slide7.Shapes("5").TextFrame.TextRange
End If
End Sub
At first, it work fine but after that, it showed an error that the Qs (in Slide 5) were not supported
I tried to make it more simple and it still does not work.
Sub Loadde()
If Slide3.Shapes("MA_VONG") = 1 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide6.Shapes("1").TextFrame.TextRange
Slide5.Shapes("Q2").TextFrame.TextRange = Slide6.Shapes("2").TextFrame.TextRange
Slide5.Shapes("Q3").TextFrame.TextRange = Slide6.Shapes("3").TextFrame.TextRange
Slide5.Shapes("Q4").TextFrame.TextRange = Slide6.Shapes("4").TextFrame.TextRange
Slide5.Shapes("Q5").TextFrame.TextRange = Slide6.Shapes("5").TextFrame.TextRange
End If
End Sub
Can somebody explain to me what is wrong with this code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些建议:
首先,尚不清楚您是否在其他地方使变量变暗。
接下来, slide3.形状(“一些名称”)= 1 将失败。没有这样的属性。您到底要在这里测试什么?形状中的文本或形状根本存在?还是其他?
最后,可以肯定的是,实际上是否存在幻灯片上名为1的形状,还是您试图引用幻灯片上的第一个形状,在这种情况下,您将使用slide6.shape6.1)(1)(引号中的“ 1”) 。
A few suggestions:
First, it's not clear whether you've DIMmed your variables elsewhere.
Next, Slide3.Shapes("some name") = 1 will fail. There's no such property. What exactly are you trying to test for here? The text in the shape or that the shape exists at all? Or something else?
Finally, just to be sure, IS there actually a shape named 1 on Slide6 or are you trying to reference the first shape on the slide, in which case you'd use Slide6.Shapes(1) (not "1" in quotes).