Programmtically insert text at the cursor on a slide?

G

Guest

How can I programmatically insert text onto a slide where the cursor is
currently set at? I have a toolbar with a combo box and a button and when
they click the button I want to insert the text in the combo box onto the
current slide whereever the cursor is currently set to?

Thanks

Scott
 
A

Austin Myers

You can't just drop text on the slide, it must reside in either a PPT object
or a VBA control.

Austin Myers
MS PowerPoint MVP Team

Solutions to Multimedia in PowerPoint www.pfcmedia.com
 
G

Guest

Right..I understand that part. What I want to be able to do is be able to
programmatically determine what shape/object the cursor is in and insert text
at that location when they click my button on the command bar i created.

Thanks

Scott
 
S

Steve Rindsberg

Right..I understand that part. What I want to be able to do is be able to
programmatically determine what shape/object the cursor is in and insert text
at that location when they click my button on the command bar i created.


' This calls the subroutine below
Sub TestInsertText()
InsertText "Hi there. I'm your text. Insert me."
End Sub

' This does the actual work and is what you'd call from
' your own code:
Sub InsertText(sText As String)
With ActiveWindow.Selection
If .Type = ppSelectionText Then
.TextRange.Text = sText
Else
MsgBox "Select some text and try again. Thanks ever so much."
End If
End With
End Sub
 

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