aditee
asked on
How to merge several text boxes into one textbox in PowerPoint using excel vba
Hi,
I have copied some text from excel to PowerPoint. But now, i want to merge all the text boxes in PowerPoint into one but usong excel vba. Please help me out with the solution.
I have copied some text from excel to PowerPoint. But now, i want to merge all the text boxes in PowerPoint into one but usong excel vba. Please help me out with the solution.
Rather than creating individual text boxes and then merging them, why not create one and then add to it with subsequent copied text?
ASKER
Hi,
Actually, i am copying the text from different cell and thus automatically text box is been created for each cell. Though i had created one text box at starting of the code. But every time it copies the text from the cell while pasting in slide automatically text box is been created.
Actually, i am copying the text from different cell and thus automatically text box is been created for each cell. Though i had created one text box at starting of the code. But every time it copies the text from the cell while pasting in slide automatically text box is been created.
Add PowerPoint as a Topic for your question and your question will get seen by more experts with ppt knowledge.
ASKER
Hi, i have already added PowerPoint as topic for my question.
If you adopt Rob's suggested methodology you can append text to an existing TextRange in PowerPoint using the InsertAfter method like this:
Note that this method will not maintain the text formatting so the format used will be that of the last character in the existing text range. If you want to maintain the source text format, you could do something like this:
With Application.ActivePresentation.Slides(1).Shapes(1)
.TextFrame.TextRange.InsertAfter MyString
End With
Note that this method will not maintain the text formatting so the format used will be that of the last character in the existing text range. If you want to maintain the source text format, you could do something like this:
' Appends the formatted text range from on shape to another
Sub AppendTextRange()
Dim oTR1 As TextRange2
Dim oTR2 As TextRange2
With ActivePresentation.Slides(1)
Set oTR1 = .Shapes(1).TextFrame2.TextRange
Set oTR2 = .Shapes(2).TextFrame2.TextRange
oTR2.Copy
oTR1.InsertAfter(oTR2).PasteSpecial (msoClipboardFormatNative)
End With
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help. The code worked very well.