Insert Objects at the end of a document

D

DDR

I'm trying to enter an object at the end of a Word document (similar to
Insert->Object). Attached is the code I am using. However, the object keeps
getting placed at the top of the Word document. When I manually perform the
Insert->Object, with the cursor at the end of the document, it places the
object after the cursor. When I do it through code, I see the cursor move to
the end of the document, but still the object does not get placed after the
cursor.

ActiveDocument.Content.Select
With Selection
.EndKey Unit:=wdStory
.TypeParagraph
ActiveDocument.Shapes.AddOLEObject FileName:=BODoc.FullName,
linktofile:=True
End With
 
D

Doug Robbins

What version of Word? In 2003 I believe that you would use

ActiveDocument.InlineShapes.AddOLEObject

specifying the range as in:

ActiveDocument.InlineShapes.AddOLEObject _
ClassType:="Excel.Sheet", DisplayAsIcon:=False, _
Range:=ActiveDocument.Paragraphs(2).Range


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

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