Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2006

Tip: Looking for answers? Try searching our database.

Word Automation Paste Issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
stuart@stricky.f2s.com - 11 Aug 2006 09:09 GMT
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
Jonathan West - 11 Aug 2006 14:46 GMT
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.

Signature

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

> hi,
>
[quoted text clipped - 30 lines]
>
> cheers, Stu

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.