'Textbox not support for property and menthod in VBA ppt
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?
Solution 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).
Sub Loadde()
If Slide3.Shapes("MA_VONG") = 1 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide6.Shapes("1").TextFrame.TextRange
' ...
ElseIf Slide3.Shapes("MA_VONG") = 2 Then
Slide5.Shapes("Q1").TextFrame.TextRange = Slide7.Shapes("1").TextFrame.TextRange
' ...
End If
End Sub
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Steve Rindsberg |
