PDA

View Full Version : Copying Text from One Shape on one slide and Pasting it into another shape on another



mikeg0282
12-28-2022, 01:59 PM
Hello! I'm really hoping you all can help me out. I'm at a complete loss, and all of the current content I looked at didn't help much. I (obviously) am very new to this, and have hit a bit of a snag.

In the code below, I am trying to take the text from "dsscust1stname" on the "Infokey" slide and paste the text into the "TextBox3" on the "Coverletter" slide however it breaks right at the end of the code, giving a compile error: method or data member not found. Help???


Sub ReplaceALL()
Dim objPresentation As Presentation
Dim objSlide1 As Slide
Dim objTextBox1 As Shape
Dim objSlideA As Slide
Dim objTextBoxA As Shape
Set objPresentation = ActivePresentation
Set objSlide1 = objPresentation.Slides("Coverletter")
Set objTextBox1 = objSlide1.Shapes.Item("TextBox3")
Set objSlideA = objPresentation.Slides("Infokey")
Set objTextBoxA = objSlideA.Shapes.Item("dsscust1stname")
objTextBox1.TextFrame.TextRange.Text = objTextBoxA.TextFrame.Value
End Sub

georgiboy
01-06-2023, 08:44 AM
Could it be that:

objTextBoxA.TextFrame.Value

Should it not be be .Text instead of .Value

John Wilson
01-06-2023, 11:56 AM
It can't be .text or .value. Milkeg you need to make it clear whether the text boxes are standard textboxes or ActivX boxes (That can be changed in show mode)##If they are standard textboxes it might be

Set objTextBox1.TextFrame.TextRange= objTextBoxA.TextFrame.TextRange