PDA

View Full Version : PowerPoint VBA code needed...



PwrPntDude10
06-23-2008, 11:16 AM
I'm trying to make a skin for Windows with PPT (and it's coming out good) and I need some help. I need a script that will see if the text in one textbox (TextBox1) is equivalrnt to text in another one (TextBox2.Text) if if it is goes to a different slide (Slide1) and if they are not equal it displays a Msgbox.:dunno IDK how to cuz i'm a noob.

CrazyPP2007
07-23-2008, 09:13 PM
Hi PwrPntDude10
I am new here too, but I can help this. You probably already figured out this in the last month, but here is an example of what you can do.

Sub ValueTest()
Dim firstVar As String
Dim secondVar As String
firstVar = ActivePresentation.Slides(2).Shapes(1).TextFrame.TextRange.Text
secondVar = ActivePresentation.Slides(2).Shapes(2).TextFrame.TextRange.Text
If firstVar = secondVar Then ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Text = firstVar
End Sub


The trick is to find out the names of the shapes where the text is located. To find out the names or rename the shapes you can google VBA PowerPoint naming shapes. Go to the PPTools website (sorry I can't post a link in this forum yet).

This website also will explain how to use VBA if you need it. If you need any more help let me know. I am hoping someone might help me with my question if I start answering some of the other peoples!

CrazyPP2007