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 / April 2006

Tip: Looking for answers? Try searching our database.

Images never paste in document as "inline"

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AnneT - 25 Apr 2006 05:11 GMT
Hi,
Word2003.  Tools.Options.Edit.PastePicturesAs - Inline with text.

I am trying to paste an image from the clipboard into a Word Document via
VBA.  I have the setting set correctly under tools.  It never pastes as
inline.  After pasting, I always have to explicitly convert to inline shape.

Also, because it doesn't paste inline, if I am trying to set the image into
a table cell, the convert to inline shape sets the image in the correct row,
but always column 1, not column 2.

Any ideas of why I cannot paste inline?  Two code snippets below.  I am
running the code from Excel - trying to generate Word reports out of Excel,
hence the "wrdapp", "wrddoc", "wrdrange" references:

'Try to paste into row1, col2
wrdDoc.Tables(1).Cell(Row:=1, Column:=2).Range.Select
With wrdApp.Selection
             .InsertAfter "hello"          'make sure selection is in the
right column
             .PasteSpecial Placement:=wdInLine     'still doesn't work
End With
wrdDoc.Shapes(1).ConvertToInlineShape     'have to convert to inline, placed
r1c1

'try to paste into row2, col2
wrdDoc.Tables(1).Cell(Row:=2, Column:=2).Range.Select
wrdApp.Selection.PasteSpecial Placement:=wdInLine            'still doesn't
work
wrdDoc.Shapes(1).ConvertToInlineShape

'try to paste into 1st para
Set wrdrange = wrdDoc.Paragraphs.First.Range
With wrdDoc.Paragraphs(1).Range
   .InsertAfter strEvent
   .Paste                           'doesn't paste inline even though
default set
End With
wrdDoc.Shapes(1).ConvertToInlineShape

The really strange part is even if i just open a new document, and select
paste, the image is not pasted inline.

What am I missing?

Thanks for your help
Jezebel - 25 Apr 2006 05:23 GMT
VBA's PasteSpecial doesn't refer to the setting under Tools > Options.

My guess is that you're running this code in Excel using CreateObject rather
than by adding a reference to the Word object library to your Excel VBA
project. As a consequence, Excel's VBA doesn't know the value of the
WdOLEPlacement constants.

> Hi,
> Word2003.  Tools.Options.Edit.PastePicturesAs - Inline with text.
[quoted text clipped - 48 lines]
>
> Thanks for your help
AnneT - 26 Apr 2006 00:01 GMT
Thanks for responding.  I do use the CreateObject method.  Here is my
beginning code:

Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
'On Error GoTo Message
Set wrdDoc =
wrdApp.Documents.Open("c:\TheFundRaiserPlannerTemplates\zPurchaseReportTemplate.doc")

However, I have added Word to my Excel VBA reference library, so it should
recognize the Word constants.

Even more confusing, if I just open a completely new word document outside
of my application, the image is NOT pasted inline, although my settings
indicate that it should.  I'm thinking that it's something within Word not
recognizing inline paste.  I can convert the images, either manually or via
VBA to inline, but can't seem to paste an image inline.  Any ideas?

> VBA's PasteSpecial doesn't refer to the setting under Tools > Options.
>
[quoted text clipped - 55 lines]
> >
> > Thanks for your help
 
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.