insertion point after inserting a picture

K

Kumar

Hello,

I am inserting a picture at the insertion point position using
addoleobject method in Vba. My problem is after the picture is
inserted, the insertion point goes to the top of the document. How do
I ensure to have the insertion point at the end of the picture after
it is inserted.

I tried using:
Dim oRng As Range

Set oRng = Selection.Range

before the addoleobject code and then
oRng.Select at the end. This keeps the insertion point at the starting
point of the picture...I need the insertion point at the end of the
picture? Pls help.

Thanks
Kamur
 
C

Cindy M -WordMVP-

Hi Kumar,

Are you using the Shapes or the InlineShapes collection for this method?
Are you setting an object variable to the picture as you insert it? Why
are you using addoleobject rather than addpicture? And finally, which
versino of Word are we dealing with?
I am inserting a picture at the insertion point position using
addoleobject method in Vba. My problem is after the picture is
inserted, the insertion point goes to the top of the document. How do
I ensure to have the insertion point at the end of the picture after
it is inserted.

I tried using:
Dim oRng As Range

Set oRng = Selection.Range

before the addoleobject code and then
oRng.Select at the end. This keeps the insertion point at the starting
point of the picture...I need the insertion point at the end of the
picture?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
K

Kumar

Hi Cindy,

Sorry I forgot to mention it is a watermark picture. I amusing Shapes
collection. My code is:

Set sh = ActiveDocument.Shapes.AddOLEObject(ClassType:="Paint.Picture",
_
filename:="C:\windows\triangles.bmp", LinkToFile:=True,
_
DisplayAsIcon:=False, Left:=x, Top:=y)
sh.WrapFormat.Type = 3 'wdWrapNone
sh.PictureFormat.ColorType = 4 'msoPictureWatermark
sh.ZOrder 5 'msoSendBehindText
'sh.Move
sh.LockAnchor = False
sh.PictureFormat.Brightness = 0.5
sh.PictureFormat.Contrast = 1

I am using Word 2000.

Thanks
Kamur
 
M

Martin Seelhofer

Set sh = ActiveDocument.Shapes.AddOLEObject(ClassType:="Paint.Picture", _
filename:="C:\windows\triangles.bmp", LinkToFile:=True, _
DisplayAsIcon:=False, Left:=x, Top:=y)

You might want to add Anchor:=Selection.Range (e.g. after Top:=y)
or another Range-Returning Expression to the Call to AddOLEObject...


Cheers,

Martin
 

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