Create a fill-in variable in powerpoint

In word I'm using the following to insert a text from an input box in a designated area in word:

Sub OpenWord()


   Dim var1 As String
   var1 = InputBox("vul!")

   Documents.Open ("C:\Documents and Settings\aa471714\Desktop\TEMP BESTANDEN/Doc2.doc")
   ActiveDocument.Bookmarks("Test").Select
   Selection.Text = var1


End Sub

I know would like to create to same function for something in powerpoint. So what I did in word (classifying a bookmark area in word as "test" and then fill in a variable there) in want to do in powerpoint as well. Define an object in some way so I can fill in a variable there.

Anybody a clue on how I have to do this in PPT?

Answers


Here's the basics of what you need.

Sub WriteToTextBox()
Dim tb As Shape
Dim sld As Slide
Dim pres As Presentation
Dim var1 As String


var1 = InputBox("Var1")
Set pres = ActivePresentation
Set sld = pres.Slides(23) 'Modify as needed

Set tb = sld.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 100, 50) 'Modify dimensions as needed
    tb.name = "unique name"  '< assign a unique name to the textbox so you can refer to it later
    tb.TextFrame.TextRange.Text = var1



End Sub

Sub ReadFromTextBox()
Dim s$
Dim sld As Slide
Dim pres As Presentation
Set pres = ActivePresentation
Set sld = pres.Slides(23) 'Modify as needed


s = sld.Shapes("unique name").TextFrame.TextRange.Text 'Read the value from the textbox
MsgBox s 

End Sub

Need Your Help

One swing timer at once?

java swing animation timer actionlistener

I'm using a swing timer to animate a figure movement in my game.

Spring JavaConfig JPA issue - " No bean named 'entityManagerFactory' is defined"

spring java-ee jpa spring-data-jpa spring-java-config

I'm in the process of converting XML based configuration for a Spring Java Web project to JavaConfig.