Powerpoint textbox copy from slide to slide

S

sccrgod

I am trying to get information entered in a powerpoint by the user, through a
visual basic text box, to carry from one slide to the next. I cannot seem to
get it. I can get information to carry from one textbox to another on the
same slide, just not from one slide to another. Any suggestions.
 
S

sccrgod

I got all the code I am using I got from the help files. It has been 10 plus
years since I used VB, so I don't remember much.

Here is the code that works:


Dim MyData As DataObject

Private Sub CommandButton1_Click()
'Need to select text before copying it to Clipboard
TextBox1.SelStart = 0
TextBox1.SelLength = TextBox1.TextLength
TextBox1.Copy
Set MyData = New DataObject
MyData.GetFromClipboard
TextBox2.Text = MyData.GetText(1)
End Sub

Private Sub UserForm_Initialize()


End Sub

Private Sub TextBox1_Change()

End Sub

Private Sub TextBox13_Change()

End Sub

Private Sub TextBox3_Change()

End Sub

Private Sub TextBox4_Change()

End Sub

Here is the code that doesn't quite work. It doesn't seem to copy to the
clipboard.

Dim MyData As DataObject


Private Sub CommandButton1_Click()

'Need to select text before copying it to Clipboard
With ActivePresentation
.Slides(2).TextBox1.SelStart = 0
.Slides(2).TextBox1.SelLength = TextBox1.TextLength
.Slides(2).TextBox1.Copy

Set MyData = New DataObject
MyData.GetFromClipboard
.Slides(3).Shapes.Range(Array(2)).TextBox2.Text = MyData.GetText(1)
End With
End Sub

Private Sub UserForm_Initialize()

TextBox1.Text = "Move this data to the " _
& "Clipboard, to a DataObject, then to "
& "TextBox2!"


End Sub


Private Sub TextBox1_Change()

End Sub



Private Sub TextBox2_Change()

End Sub
 
J

John Wilson

Try this sort of thing:

Assuming both textboxes have the default name and the target textbox is on
slide 2.

Dim strtextin As String
Private Sub CommandButton1_Click()
'current slide in show
strtextin = ActivePresentation.SlideShowWindow.View.Slide _
..Shapes("TextBox1").OLEFormat _
..Object.Text
'target (assumes slide 2)
ActivePresentation.Slides(2).Shapes("TextBox1").OLEFormat _
..Object.Text = strtextin
End Sub--
-------------------------------------------
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 
S

sccrgod

Thanks it worked great.

John Wilson said:
Try this sort of thing:

Assuming both textboxes have the default name and the target textbox is on
slide 2.

Dim strtextin As String
Private Sub CommandButton1_Click()
'current slide in show
strtextin = ActivePresentation.SlideShowWindow.View.Slide _
.Shapes("TextBox1").OLEFormat _
.Object.Text
'target (assumes slide 2)
ActivePresentation.Slides(2).Shapes("TextBox1").OLEFormat _
.Object.Text = strtextin
End Sub--
-------------------------------------------
Amazing PPT Hints, Tips and Tutorials

http://www.PPTAlchemy.co.uk
http://www.technologytrish.co.uk
email john AT technologytrish.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top