PDA

View Full Version : Insert Text Frame at Cursor Position



Andy505
03-17-2008, 12:47 PM
Below is the code I use to insert a text frame in a Word document. In this example, the frame is positioned 60 points from Left and 40 points from Top. Instead of using Left and Top positioning, is it possible with VBA code to insert a text frame (or text box), where the cursor is currently positioned in the document?

Your help is much appreciated.

Sub InsertTextFrame()
ActiveDocument.Shapes.AddShape(1, 60, 40, 50, 20) _
.TextFrame.TextRange.Text = "xyz"
End Sub

fumei
03-17-2008, 01:27 PM
Please, when you cross post, it is good form to mention it on the site you post at.

This is cross-posted at Tek-Tips and I have already responded there.

http://www.excelguru.ca/node/7

mdmackillop
03-21-2008, 08:50 AM
Can we have a link to that location?

fumei
03-22-2008, 06:53 AM
http://tek-tips.com/viewthread.cfm?qid=1459089&page=2