Word Automation Paste Issue

S

stuart

hi,

i have an issue with pasteing an image out of a text box back onto a
word document and repositioning it on the document so i can select the
picture as a shape for copying into powerpoint.

every time i paste the copied image it overwrites the whole document.

any help would be appreciated.

For iCount = 1 To oDoc.Shapes.Count
If oDoc.Shapes(iCount).Type = msoTextBox Then
If
oDoc.Shapes(iCount).TextFrame.ContainingRange.InlineShapes.Count <> 0
Then
Clipboard.Clear

oDoc.Shapes(iCount).TextFrame.ContainingRange.InlineShapes(1).Select
m_objWord.Selection.Copy
iImgLeft = oDoc.Shapes(iCount).Left
iImgTop = oDoc.Shapes(iCount).Top
oDoc.Shapes(iCount).Delete
m_objWord.Selection.Collapse wdCollapseStart
oDoc.Content.PasteSpecial
placement:=wdFloatOverText
'odoc.Range.
m_objWord.Selection.InlineShapes(1).ConvertToShape
m_objWord.Selection.ShapeRange(1).Left = iImgLeft
m_objWord.Selection.ShapeRange(1).Top = iImgTop
End If
End If
Next

cheers, Stu
 
J

Jonathan West

This line is the problem

oDoc.Content.PasteSpecial

Where do you want the image pasted? Define a Range object variable for that,
make sure that you apply the Collapse method to it so that it defines and
insertion point, and then use the PasteSpecial method on it.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

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