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
Application.CutCopyMode = False
.TypeParagraph
End Sub
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
.TypeParagraph
Application.CutCopyMode = False
MyData.SetText ""
MyData.PutInClipboard
SheetFrontPage.Range(SheetFrontPage.Cells(1, 1), SheetFrontPage.Cells(13, 5)).Cells.CopyPicture
.Paste
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
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 WithEnd Sub