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

Re: Word Automation Paste Issue by Jonathan

Jonathan
Fri Aug 11 08:46:29 CDT 2006

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

<stuart@stricky.f2s.com> wrote in message
news:1155283770.489853.39260@i42g2000cwa.googlegroups.com...
> 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
>