Copy Shape from Excel and Paste in Word as InLineShape (VBA 2003)

FotS

New Member
Joined
Jun 16, 2011
Messages
37
Hi,

Ok, so here's what I'm trying to do. Using code in Excel from the object "ThisWorkbook", create a new instance of a Word doc and then copy a picture (.jpg) that has been inserted into Sheet2 of said workbook and paste it into the newly created Word doc as an InLineShape. Reason is I don't want to hard code a file path using InLineShape.AddPicture(filepath), which otherwise works perfectly for me.

I've adapted my code to this so far (note: This isn't the complete code. There's a lot before and after this, but this section is unaltered other than added comments):
Code:
With .Selection  'from "With appWD" where appWD is the Word doc
    .Font.Size = 14
    
    Sheet2.Shapes(1).Copy  'where the picture is
    .Paste
    Set shapeInline = appWD.ActiveDocument.Shapes(1).ConvertToInlineShape
    shapeInline.ScaleHeight = 40
    shapeInline.ScaleWidth = 40
It works ok, except that after scaling the picture, there is a gray "void" left on the page and I can select a picture rectangle right next to it that is the size of the original Shape picture. Yet, adding in the line "appWD.ActiveDocument.Shapes(1).Delete" returns an error:

Invalid procedure call or argument

So... my question is, is there a simpler way to Copy a shape from an Excel spreadsheet and paste it into a Word doc as an InLineShape than what I'm doing? If not, what am I missing to clear out the remnants of the original picture paste job?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Bump from pg 4 before heading home for the weekend....

No internet from home, so I won't be able to check it before Monday... :(
 
Upvote 0
Either I've got some bad timing today on the thread bumping, or no one knows the answer....

Bump from pg 9...
 
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,874
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top