'This is the function I want. 'Paste the contents as plain text of the clipboard after the current text
The following code works
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter "ttt"
'InsertAfter seems Accept only strings
Although it comes from the https://docs.microsoft.com/zh-tw/office/vba/api/powerpoint.textrange.insertafter
The following code does not work
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter.Paste
'This is the function I want.
'Paste the contents as plain text of the clipboard after the current text
I wish it could be I have tried the following codes, but none of them work.
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter.PasteSpecial ppPasteText
'https://www.youtube.com/watch?v=bGiAZZk6LlI
'or
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter.
Application.CommandBars.ExecuteMso ("PasteTextOnly") 'pasting as plain text
but The following code works
ActiveWindow.Activate
Application.CommandBars.ExecuteMso ("PasteSourceFormatting")'pasting as plain text
CodePudding user response:
Yes, Mr. Korchok.
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter.PasteSpecial ppPasteText
The code does not work
After I ran it, I got the following result
Execution Results
Before program execution
Before program execution
my clipboard text is "SlideMaster Modify"
The result of the program execution I want is
The result of the program execution I want is
How to modify the code to get the desired result
Thank you for your willingness to reply to me.
CodePudding user response:
I found the answer
I refer to here for the answer - Thank you very much
https://www.office-forums.com/threads/ppt-2007-bug.177297/
The following code works
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter (vbLf)
'Line break
ActiveWindow.View.Slide _
.Shapes.Placeholders.Item(3).TextFrame.TextRange.InsertAfter(" ").PasteSpecial ppPasteText
'Paste Text Only
'ref https://www.office-forums.com/threads/ppt-2007-bug.177297/