JeroenW
JeroenW

Reputation: 3

How to check the text inside a textbox on a random slide in VBA (PowerPoint)?

For a presentation I am making, I want to check if the text inside a textbox (the name of that textbox is TextBox2 and is an ActiveX-control) is the same as the text in another textbox (the name of this textbox is naam but is not an ActiveX-control). This is the code I have now:

Dim osld As Slide
Set osld = ActivePresentation.SlideShowWindow.View.Slide

Dim vragen As Byte
Dim juist As Byte
Dim fout As Byte

If osld.Shapes("TextBox2").TextFrame.TextRange = osld.Shapes("naam").TextFrame.TextRange Then
osld.Shapes("TextBox2") = ""

When I want to run this code, I get an error (Method or data member not found).

How can I make this code working?

Upvotes: 0

Views: 270

Answers (1)

Steve Rindsberg
Steve Rindsberg

Reputation: 14810

activepresentation.Slides(1).Shapes("TextBox1").OLEFormat.Object.Text

Instead of

If osld.Shapes("TextBox2").TextFrame.TextRange = etc

use

If osld.Shapes("TextBox2").OLEFormat.Object.Text = etc

and

osld.Shapes("TextBox2").OLEFormat.Object.Text = ""

Upvotes: 1

Related Questions