Cells.CopyPicture - Copying Picture from Excel to Word - copy picture method of range class failed error

NicBob

New Member
Joined
Feb 13, 2015
Messages
1
Hi, I have a problem when copying an image to word. I know that it is the clipboard and that because it is an image that is being copied that it does not clear when using Application.CutCopyMode = False, or when using:

Public MyData As DataObject
Set MyData = New DataObjectMyData.SetText ""
MyData.PutInClipboard

The above allow for the code to run more often however I would still like to clear my clipboard of the images. The code runs but when it is repeated a number of times, then it stops.

If this cannot be done, is there a more efficient way of importing the image into word that bypasses the clipboard?

I do not want to access files with saved pictures in them and would prefer to access the image directly from excel and move it to word. This is my first time posting, so please be patient.

I have pasted my code below.


Public MyData As DataObject

Sub TitlePage()


Set MyData = New DataObject
MyData.SetText ""
MyData.PutInClipboard


SheetFrontPage.Visible = xlSheetVisible
Set wrdapp = CreateObject("Word.Application")
'On Error Resume Next
With wrdapp
.Documents.Add
With .Selection
.TypeParagraph
.TypeParagraph​

Application.CutCopyMode = False​
MyData.SetText ""
MyData.PutInClipboard
SheetFrontPage.Range(SheetFrontPage.Cells(1, 1), SheetFrontPage.Cells(13, 5)).Cells.CopyPicture
.Paste​

.TypeParagraph​
.TypeParagraph
Application.CutCopyMode = False
MyData.SetText ""
MyData.PutInClipboard
SheetFrontPage.Range(SheetFrontPage.Cells(15, 1), SheetFrontPage.Cells(15, 7)).Copy
.Paste
.TypeParagraph
.TypeParagraph
Application.CutCopyMode = False
MyData.SetText ""
MyData.PutInClipboard
SheetFrontPage.Range(SheetFrontPage.Cells(17, 1), SheetFrontPage.Cells(17, 7)).Copy
.Paste
.TypeParagraph


Application.CutCopyMode = False
MyData.SetText ""
MyData.PutInClipboard
SheetFrontPage.Range(SheetFrontPage.Cells(18, 1), SheetFrontPage.Cells(25, 7)).Cells.CopyPicture
.Paste


.TypeParagraph
.TypeParagraph
.TypeParagraph
.InsertBreak Type:=2​
End With​
End With
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

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