INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Word table paste/pastespecial into cell issue

Word table paste/pastespecial into cell issue

(OP)
Hi all,

I am trying to pastespecial an image into a specific cell in a word table. When I use the simple paste it is placed into the correct cell but when I use pastespecial it always goes into the 1st column of the table.

I'm in Office 2013 and creating a chart in Excel and then trying to place it into the word table:

Works but I need an image:
oTbl.Cell(nTblCellRow, nTblCellCol).Range.Paste

Is an image but always in the 1st column of the word table regardless of the nTblCellCol value:
oTbl.Cell(nTblCellRow, nTblCellCol).Range.PasteSpecial Link:=False, DataType:=14, _
Placement:=0, DisplayAsIcon:=False

So What the heck can I do to get my desired outcome? Thank you!

RE: Word table paste/pastespecial into cell issue

(OP)
I'd love to hear if there is a better solution but I defined a 1x1 working table in word and did the pastespecial there then I copied that result and did the normal paste into where I actually wanted it. At the end of the process I delete the working table.

RE: Word table paste/pastespecial into cell issue

Hi,

I don't see a 14 for DataType

Name                           Value       Description
wdPasteBitmap                   4          Bitmap.
wdPasteDeviceIndependentBitmap  5          Device-independent bitmap.
wdPasteEnhancedMetafile         9          Enhanced metafile.
wdPasteHTML                    10          HTML.
wdPasteHyperlink                7          Hyperlink.
wdPasteMetafilePicture          3          Metafile picture.
wdPasteOLEObject                0          OLE object.
wdPasteRTF                      1          Rich Text Format (RTF).
wdPasteShape                    8          Shape.
wdPasteText                     2          Text.

 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Word table paste/pastespecial into cell issue

(OP)
I don't see it documented either but it is recognized. Visually it looks identical to wdPasteShape. I can't remember where I got 14 from. 14 seems to be an image copy of wdPasteShape. The formatting of the graphs are retained when the document is later opened in Word 2010 but with wdPasteShape the formatting is lost.

RE: Word table paste/pastespecial into cell issue

Although DataType:=14 isn't listed, I don't get an error when using it with a suitable data type, but it does result in the object appearing in the wrong cell. Using undocumented 'features' is unreliable. Moreover, the image goes into the nominated table cell when using documented data types, such as:
oTbl.Cell(nTblCellRow, nTblCellCol).Range.PasteSpecial Link:=False, DataType:=3, Placement:=0, DisplayAsIcon:=False
or:
oTbl.Cell(nTblCellRow, nTblCellCol).Range.PasteSpecial Link:=False, DataType:=8, Placement:=0, DisplayAsIcon:=False

Cheers
Paul Edstein
[MS MVP - Word]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close